The member variable of the class will be initialized before the member function (even structure).
It is necessary to summarize the creation process of the object. Consider a class named Dog:
(1) When an object of type DOG is created for first time, or the STATIC method / static field of the Dog class is first accessed, the Java interpreter must find Dog.Class (search in advance in advance).
(2) After finding dog.class (it creates a Class object, this will be learned later), all of its STATIC initial modules will run. Therefore, STATIC initialization only occurs once - when the Class object is loaded first.
(3) When you create a New Dog (), the build process of the DOG object will first assign enough storage space for a DOG object in the memory stack (HEAP).
(4) This storage space will be zero, set all the basic types in the Dog to their default values (zero for numbers, and equivalence settings of Boolean and Char).
(5) All initialization that occurs when the field definition is performed.
(6) Execute the builder. As will be said in Chapter 6, this actually requires considerable operation, especially when involving inheritance.