Question: Assuming that the following classes have been defined: public class One { public void method1() { System.out.println(One1); } } public class Two extends One {

Assuming that the following classes have been defined: public class One { public void method1() { System.out.println("One1"); } } public class Two extends One { public void method3() { System.out.println("Two3"); } } public class Three extends One { public void method2() { System.out.println("Three2"); method1(); } } public class Four extends Three { public void method1() { System.out.println("Four1"); super.method1(); } public void method3() { System.out.println("Four3"); } } And assuming the following variables have been defined: One var1 = new Two(); One var2 = new Three(); One var3 = new Four(); Three var4 = new Four(); Object var5 = new Three(); Object var6 = new One();

Show the output in the right-hand column for the statements in the left-hand column. If the statement produces more than one line of output, indicate the line breaks with slashes as in "a/b/c" to indicate three lines of output with "a" followed by "b" followed by "c". If the statement causes an error, fill in the right-hand column with either the phrase "compiler error" or "runtime error" to indicate when the error would be detected

var1.method1(); ____________________________ var2.method1(); ____________________________ var3.method1(); ____________________________ var4.method1(); ____________________________ var5.method1(); ____________________________ var6.method1(); ____________________________ var4.method2(); ____________________________ var4.method3(); ____________________________ ((Two)var1).method2(); ____________________________ ((Three)var1).method2(); ____________________________ ((Two)var1).method3(); ____________________________ ((Four)var2).method1(); ____________________________ ((Four)var3).method1(); ____________________________ ((Four)var4).method3(); ____________________________ ((One)var5).method1(); ____________________________ ((Four)var5).method2(); ____________________________ ((Three)var5).method2(); ____________________________ ((One)var6).method1(); ____________________________ ((One)var6).method2(); ____________________________ ((Two)var6).method3(); ____________________________

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!