I am doing some research on JAVA initialization process. Here is a good material for reference: When a class is loaded and initialized in JVM
On this page there is rule says: 3) If Class initialization is triggered due to access of static field, only Class which has declared static field is initialized and it doesn't trigger initialization of super class or sub class even if static field is referenced by Type of Sub Class, Sub Interface or by implementation class of interface.
I really don't understand the idea. If the static field is referenced by Sub class, then this field of course need to create a sub class object or assigned by a Sub class object. So, it definitely triggers Sub class initialization.
What's wrong with my interpretation?
EDIT:
- It DOES trigger Super Class static initialization.
- If the static field is final, and the static final field is initialized when declaring. Then it will neither load the class nor initialize the class, for this static final field is a compile time constant value. Attention: if the static final field is initialized in static block, then this statement does NOT hold anymore.