晚上好,請你看看,以證明有資格爲GC對象的數目此代碼示例:我看到有四個對象時做這符合GC計數這是符合GC
public class CardBoard {
Short story = 5;
CardBoard go(CardBoard cb) {
cb = null;
return cb;
}
public static void main(String[] args) {
CardBoard c1 = new CardBoard();
CardBoard c2 = new CardBoard();
CardBoard c3 = c1.go(c2);
c1 = null;
// do Stuff
}
}
東西是c3,它是關聯的故事對象和c1以及它相關的故事對象,你看到了什麼?
...我們在接受採訪嗎? :-) – radai
確切的複製:http://stackoverflow.com/questions/13109717/java-garbage-collection-and-null-reference – MrKiller21