posted 16 years ago
Hi,
B extends Thread and A extends B. Hence, A IS-A B and B IS-A Thread. When you say: Thread a = new B(new A());, JVM chooses Object B at runtime and constructs a new B. Since B's constructor can take a 'B' Object and A IS-A B, therefore the run() method of B is called and the output is 1.