其中数组保存在内存中的Java? [英] where is array saved in memory in java?
本文介绍了其中数组保存在内存中的Java?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我在那个函数我声明函数:
If I have a function that in that function I declare:
Object arr[] = new Object[20];
在哪里改编和存储整个数组?堆?栈?
不要紧,如果该声明是在某些功能或在main()?
Where are arr and the whole array stored? heap? stack? Does it matter if the declaration is in some function or in main()?
和我们说,我也有这些命令行:
and let's say I also have these command lines:
arr[0] = new String("abc");
arr[1] = new List();
在哪里改编[0]
和改编[1]
存储?
推荐答案
内存图:
盒是存储器位置(其中,二进制数可被存储)。结果,
箭内存引用(即指针)。
Boxes are memory locations (where binary numbers can be stored).
Arrows are memory references (i.e. pointers).
这篇关于其中数组保存在内存中的Java?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文