小编Mus*_*afa的帖子

ArrayList实际存储了什么 - 引用对象或实际对象?

假设我的代码是这样的:

ArrayList list = new ArrayList();
Student s = new Student();    // creating object of Student class

myList.add(s);      // Here am confused ...

/* myList contains just the reference variable to the Student object, OR

   myList contains the actual Student object (memory allocation for name, rollNo etc)  ??   
*/
Run Code Online (Sandbox Code Playgroud)

在使用add()向ArrayList添加对象时:

ArrayList是"对象引用"列表或"实际对象"列表???

java arraylist

9
推荐指数
2
解决办法
1万
查看次数

标签 统计

arraylist ×1

java ×1