when evaluated produces the o/p as follows: A's static B's static A's Instance A's Constructor B's Instance B's Constructor Why after A's static, the flow comes to B's static, why not complete the A's instance and constructor call ???
First static block code is executed when the class is loaded into the JVM.Then comes the Initializing blocks of the first class of the inheritance tree and then the constructor of it,this is because every constructor contains an call to its super constructor(The main point is Initializing blocks run just before the instance is created).This order comes down till the last class and continues with the rest of the code.
Joined: Jun 27, 2007
Hi Manfred, thanks -that's a pretty cool explanation. I must have tried to instantiate one more B.