I have defined a class Father and another class Son extending Father. They both have static blocks. When creating the first Son-instance always the static block of the Father-class is executed and after that Son's static block. As far as I understand that means that the Class Loader loads the Father-class first and then the Son-class. Right? If so:
Will that always be that way? Is there a specification for the JVM that will garantie such a performance or is it unpredictable in what way classes will be loaded on an arbitrary system?
Shyam Prasad Murarka
posted 9 years ago
Dear Reader, I guess it follows the hierarchy of the Son object. If 3 extends 2 extends 1.. then static method of 1 will be called first (if any).. and then down the hierarchy.. Not too sure though..