Super Keyword

11. Program

//Find the O/P ? Compile Time Error or Compile Successfully

class G { G() { System.out.println("G()"); } G(int i) { System.out.println("G(int)"); } } class H extends G { H() { super(10); System.out.println("H()"); } H(int i) { super(); System.out.println("H(int)"); } public static void main(String[] args) { H h1 = new H(); System.out.println("------"); H h2 = new H(10); System.out.println("------"); G g1 = new G(90); System.out.println("------"); G g2 = new G(); } }

12. Program

//Find the O/P ? Compile Time Error or Compile Successfully

class J { J() { System.out.println("J()"); } } class K extends J { K() { System.out.println("K()"); super(); } public static void main(String[] args) { System.out.println("done"); } }

13. Program

//Find the O/P ? Compile Time Error or Compile Successfully

class L { L() { super(); System.out.println("L()"); this(10); } L(int i) { super(); System.out.println("L(int)"); } public static void main(String[] args) { System.out.println("done"); } }

Page....