why happened?
list<string> list = new arraylist<string>(); list.add("aaa"); string s = list.get(0); list.remove(0); system.out.println(s);
console says: aaa
can explain me? thought console should null
, should be?
no, because stored value list in s
. reference "aaa"
in both list , s
, after removed list, s
has still reference it.
Comments
Post a Comment