First, the memory partition of the JVM
To understand the memory storage of an array, first understand the overall memory partitioning of the JVM, see 04JVM memory detail
Second, the array in the JVM storage detailed
If we have the following code:
In the above code, the process of creating an array can be divided into three steps:
1. Declare an array of type int ages int [] ages;
2. Initialize array new int[]{10,20,30} in the heap;
3. Assign the address of the initial array to the ages variable
Is int[] ages = new int[]{} in the memory of the embodiment of the form
You can see that the value of ages is actually the address of the array in the heap
So when you go to the print group, you'll find that you're printing an address, not a value in the array.
When executing ages = new int[]{40,50,60}
Initializes a new array in the heap
Re-assigns the address of the array to the ages
06-Play from zero javaweb-array in memory storage form