1.Person Pangzi; This is in the "open space" in the stack space
Pangzi=new person (); This is assigned to the heap space
The last two steps are doing things that correspond to space.
2. Value type directly into the stack space, such as AF, the reference type into the heap space, the stack space has an "index address", such as when the need for B, in the stack space after looking for "index address" corresponding to find the heap space "details."
Therefore, the value type is "fast" and the reference type is "flexible".
Example string S = "ABCDEFG ... Z ", then s corresponds to the stack space," ABCDEFG ... Z "corresponds to the heap space.
Example int A = 10;int F = a;int A = 11; At this time F is still 10. Since the assignment of a value type is copy, the copy is deposited, and the re-assignment of a does not affect the generated copy, then f is unchanged, 10.
Another: int A = 1234l;//here error, not "big box of Things (Long)" Ready "in a small box (int)", because there is "not fit" possible.
In the case of "accommodates" there is an int a = (int) 1234L; it is feasible to cast.
Example reference type BC point to heap space sos,d point to heap space SBS, if D cancels or changes points to, then SBS does not correspond, that becomes garbage, is detected after deletion.
Understanding of space heap space of beginner java--stack