Reference post: http://www.ibm.com/developerworks/cn/java/j-lo-clobj-init/
It shows the class life cycle flow; In this article, I'm just going to talk about the "initialization" and "Object instantiation" phases of the class.
Class initialization
Class initialization phase, which is the last work in the previous phase of a class or interface being used for the first time, this stage is responsible for assigning the correct initial value to the class variable.
The Java compiler collects all of the class-variable initialization statements and static initializers of the type into the <clinit> method, which can only be called by the JVM and is dedicated to the initialization work.
In addition to interfaces, before initializing a class, you must ensure that its direct superclass has been initialized, and that the initialization process is guaranteed to be thread-safe by the JVM. Also, not all classes will have a <clinit> () method, and the class will not have a <clinit> () method in the following conditions:
The class does not declare any class variables or static initialization statements;
The class declares a class variable, but does not explicitly initialize it with a class variable initialization statement or static initialization statement;
This class contains only class-variable initialization statements for static final variables, and class-variable initialization statements are compile-time-constant expressions.
The life cycle of the Java class