Tuesday, January 29, 2008

object initialization in java

SubClass subClass = new SubClass();



1) Static block of super class executes

2) Static block of Subclass executes

3) Inside constructor of subclass

4) call to super constructor

5) call of Object Class constructor

6) Instance Variable of super class executes

7) init blocks of super class executes,in the order in which they appear

8) Super class constructor executes

9) Instance Variable of Subclass are initialized

10) Init blocks of subclass executes, in the order in which they appear

11) Subclass constructor executes

No comments: