假设我的代码是这样的:
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是"对象引用"列表或"实际对象"列表???