/** * This code is from the book: * Winder, R and Roberts, G (1998) * Developing Java Software</em> * John Wiley & Sons. * It is copyright (c) 1997 Russel Winder * and Graham Roberts. */ class Superclass{ //Contains implicit call to super() //as first statement public Superclass(int n) { x = n; } private int x; } class Subclass extends Superclass{ //Call the other constructor using this, //no super call is done here public Subclass(){ this(10); } //Explicitly call super public Subclass(int x){ super(x); } } class l1Inherit11{//Super1 public static void main(String[] args){ Subclass subclass = new Subclass(); } } /******** sample compilation & run ******* # javac l1Inherit11.java # java l1Inherit11 # ******************************************/