Super Keyword

5. Program

//Find what it gives Compiletion Error / Compiletion Successfully / Output ?

class X { } class Y extends X { Y(int i) { System.out.println("Y(int)"); } public static void main(String[] args) { Y y1 = new Y(10); System.out.println("------"); } }

6. Program

//Find what it gives Compiletion Error / Compiletion Successfully / Output ?

class A { A(int i) { System.out.println("A(int)"); } } class B extends A { B() { System.out.println("B"); } public static void main(String[] args) { A a1 = new A(100); System.out.println("------"); B b1 = new B(); } }

7. Program

//Find what it gives Compiletion Error / Compiletion Successfully / Output ?

class S { S() { System.out.println("S()"); } } class R extends S { R() { super(); System.out.println("R()"); } } class T extends R { T() { System.out.println("T()"); } } class U { public static void main(String[] args) { T t1 = new T(); System.out.println("------"); R r1 = new R(); System.out.println("------"); S s1 = new S(); System.out.println("------"); } }

Page....