Question: Consider the following classes: public class Harry { public void method 1 ( ) { System.out.println ( harry 1 ) ; } public

Consider the following classes:
public class Harry {
public void method1(){
System.out.println("harry 1");
}
public void method2(){
method1();
System.out.println("harry 2");
}
}
public class Larry extends Harry {
public void method1(){
System.out.println("larry 1");
super.method1();
}
}
public class Mary extends Larry {
public void method2(){
System.out.println("mary 2");
}
public void method3(){
super.method1();
System.out.println("mary 3");
}
}
public class Jerry extends Mary {
public void method2(){
super.method2();
System.out.println("jerry 2");
}
}
Suppose the following variables are defined:
Harry var1= new Harry();
Harry var2= new Larry();
Larry var3= new Jerry();
Mary var4= new Mary();
Mary var5= new Jerry();
Object var6= new Larry();

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!