Consider the following Java program:
class A extends Object { void m1() { System.out.println("A_m1"); } void m2() { System.out.println("A_m2"); } void m3() { m4(); } void m4() { System.out.println("A_m4"); } } class B extends A { void m2() { m1(); } void m3() { super.m3(); } } class C extends B { void m1() { super.m1(); System.out.println("C_m1"); } void m2() { super.m2(); } void m3() { super.m3(); } } class D extends C { void m2() { System.out.println("D_m2"); } } class E extends D { void m4() { super.m3(); } } public class Exercise extends Object { public static void main(String[] args) { A a = new B(); a.m1(); a = new E(); a.m1(); a.m2(); a = new C(); a.m2(); a = new E(); a.m3(); } } |
What is the output of this program?