When running Java, the first thing that happens is to try to access main () [a static method], so the loader starts to start and find the compilation code of the corresponding class (that is, the. Class file ). During the loading process, the loader notices that it has a basic class (that is, the meaning of the extends keyword), so it loads it. This process will occur no matter whether you are preparing to generate an object of that basic class.
If the base class contains another base class, the other base class is loaded immediately, and so on. Next, perform static initialization in the root base class, and then in the next category class, and so on. It is critical to ensure this order, because the initialization of the category class may depend on the correct initialization of the base class members.
In this case, all necessary classes have been loaded, so you can create objects. First, all basic data types in this object are set to their default values, and the object handle is set to null. Then, the basic class builder is called. In this case, the call is automatically performed. However, super can also be used to specify the builder for calling from the row. The construction of the basic class adopts the same processing process as the pipeline class builder. After the basic builder is complete, the instance variables are initialized in the original order. Finally, execute the remaining body parts of the builder.