step by step explanation
Java always do the following things
1.Loading of class
2.Linking of class: verify, prepare and resolve(optional)
3.Initialize the class: Execute Initializers
4.Then invoke Test.main
see JLS(Java Language Specification 3.0)Third Edition
So for the gine code following steps occurs:
1.class Hawk is loaded then linking occurs and Initialization occurs but before that it checks for super class and if it is exist then again super class loaded then linking and then initialization this continues until it reches to top most super class.
2.After step 1 initialization start from top to bottom that is from super class to sub class in that order.
3.In initialization all class variables and static initializers are executed in texual order as they appears in class
4.Then Test.main invokes
5.pre is printed
6.constructors are excecuted in following manner
Hawk()-> calls Raptor()-> calls Bird() calls Object()
7.After step 6 all instance variables and instance initializers for class are executed in texual order and after that constructor block executed and inturn continues to subclass Hawk and lastly Hawk is printed
I hope this clears your query regarding this
If I am wrong anywhere in explanation above please notify me for that
Regards
Ninad