/*****************************************************/ // INHERIT2 // constructors class A { public int x; public A(int x) { this.x=x; } } class B extends A { public int y; public B(int x) { super(x); this.y = x; } public B(int x,int y) { this(x); this.y = y; } } public class inherit2 { public static void main(String[] args) { B b1 = new B(1); System.out.println("1st: "+b1.x+" "+b1.y); B b2 = new B(2,3); System.out.println("2nd: "+b2.x+" "+b2.y); } } /* output: 1st: 1 1 2nd: 2 3 */