Question: Task 2 Overriding, Hiding Write down the output of the following code. Program L class B void ) { System.out.println(B); } public class Override extends

Task 2 Overriding, Hiding Write down the output of the following code. Program L class B void ) { System.out.println("B"); } public class Override extends B{ // instance method f overrides instance method Buf void ) { System.out.println("Override". } void st) { // call Overridef EC); // call But super f(); 2 public static void main(String args[]) { Override o = new Override -); a } OUTPUT } Program 2: class A { static void ) { // static method System.out.println(""); } void ) { // instance method System.out.println("A3"); } public class Suba extends A{ static void ) { // static methods are not overridden System.out.println("Hide f". void st) { System.out.println("Hide-g" public static void main(String args[]) { A acef = new SubAE); // call AFO acef.f(); // call Subago aref.g(); OUTPUT }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
