ankur kothari wrote:output is: Ankur2
Ankur
Ankothari1
Ankothari
but i was expecting Ankur2(static block)
Ankothari1(constructor)
Ankur(static block)
Ankothari(static block)
Static blocks runs first and only then constructors are called.
Static blocks run only once when classes are first loaded.As class Test8 extends class Test7 both will be loaded as such their static blocks run first.After that constructors run.If I'm wrong please somebody correct me.
Dragos