标签: java object reference
在Java中,让自定义对象o的类型为CustomObject。然后,CustomObject o2 = o;会在不将o的内容复制到o2的情况下进行引用。但是这种行为是否仍然适用于CustomObject s:
o
CustomObject
CustomObject o2 = o;
o2
CustomObject[] os = new CustomObject[2]; os[1] = o; os[2] = o;
os[1]和os[2]会被引用,还是o的直接副本,从而分开对象?
os[1]
os[2]