One.
The subject is related to the object, and is the demo class in the creation of the demo object, this kind of object?
Although the beginning of the subject is an int x=3, which defines the member variables in the class, the JVM still enters the program from the main function first.
First load the main function into the stack memory main and local variable d. (after entering from the Mian main function as a portal, execute the demo d=new demo () and then int x=3.) It then opens up a demo class type space in the heap memory. The object created here is the same as the class name, which naturally introduces the attribute, the member variable x. Here is four step walk, open space, assign address, default initialization, variable assignment. Another thing to note is that the demo d = new Demo () is a three-step sequence, first running the left demo D, then the right new demo (), and finally the two links together.
Java-Preliminary Understanding-sixth-Reference data type parameter pass plot