Question: This is Java Programing Language Question 5: Inheritance Question (20 pointa): Given the following class hierarchy and the object declarations, write down the outputs produced

This is Java Programing Language
This is Java Programing Language Question 5: Inheritance Question (20 pointa): Given

Question 5: Inheritance Question (20 pointa): Given the following class hierarchy and the object declarations, write down the outputs produced by the given method calls below - assuming that there is no ordering implied in the questions and each statement is an independent one: public class Harry { public void method1() { System.out.println("harry 1"); Suppose that the following variables are defined Harry vari new Harry(); Harry var2 - new Larry(): Larry vara new Jerry(): Mary vard new Mary(): Mary vars- new Jerry(): Object var6= new Larry); public void method2() { nethodi(); Systen.out.printin("harry 2"): Indicate on each line below the output produced by each statement shown. public class Larry extends Harry { public void nethodi() { Systen.out.printin("larry 1"); super.nethod1(): If the statement produces more than one line of output indicate the line breaks with slashes as in a/ble to indicate three lines of output with a followed by b followed by e. public class Mary extends Larry ( public void nethod2()( Systen.out.print in("mary 2" : If the statement causes an error, write the word error to indicate this. G public void me thod3() { super.method1(): Systen.out.print In("nary 3"); public class Jerry extends Mary { public void method2(){ super.method2(): Systen.out.printin("jerry 2"); onthe ion var1.method1()3; .01 02 var2.method1()3; var3. method1()3; .03 var4.method1()3; .04 var5.method1(); .05 vari.method2(); .06 var4. method2(); .07 Var5.method2()3; .08 ((Mary) var5).method3 (); .09 ((Jerry) var4)- method3(); .10 Page 3 of 5

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 Databases Questions!