Where are arrays stored in memory?
•
Java
If I have a function in which I declare:
Object arr[] = new Object[20];
Where are the ARR and the entire array stored? Pile? Superposition? Is it important if it is declared in some functions or main()?
Let's say I also have these command lines:
arr[0] = new String("abc"); arr[1] = new List();
Where are arr [0] and arr [1] stored?
Solution
Memory map:
A box is a memory location (where binary numbers can be stored) Arrows are memory references (i.e. pointers)
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码