This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
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.