class Snoochy {
12. Boochybooch;
13. public Snoochy() { booch = new Boochy(this); }
14. }
15.
16. class Boochy {
17. Snoochy snooch;
18. public Boochy(Snoochy s) { snooch = s; }
19. }
And the statements:
21. public static void main(String[] args) {
22. Snoochy snoog = new Snoochy();
23. snoog = null;
24. // more code here
25. }
Which statement is true about the objects referenced by snoog,
snooch, and booch immediately after line 23 executes?
A. None of these objects are eligible for garbage collection.
B. Only the object referenced by booch is eligible for garbage
collection.
C. Only the object referenced by snoog is eligible for garbage
collection.
D. Only the object referenced by snooch is eligible for garbage
collection.
E. The objects referenced by snooch and booch are eligible for garbage
collection.
12. Boochybooch;
13. public Snoochy() { booch = new Boochy(this); }
14. }
15.
16. class Boochy {
17. Snoochy snooch;
18. public Boochy(Snoochy s) { snooch = s; }
19. }
And the statements:
21. public static void main(String[] args) {
22. Snoochy snoog = new Snoochy();
23. snoog = null;
24. // more code here
25. }
Which statement is true about the objects referenced by snoog,
snooch, and booch immediately after line 23 executes?
A. None of these objects are eligible for garbage collection.
B. Only the object referenced by booch is eligible for garbage
collection.
C. Only the object referenced by snoog is eligible for garbage
collection.
D. Only the object referenced by snooch is eligible for garbage
collection.
E. The objects referenced by snooch and booch are eligible for garbage
collection.
解决方案 »
- 抽象类与接口的区别与联系
- 结合Java对象说String的一些个人理解
- 冒泡排序注意的问题,在线交流!
- 请教大家,wsad问题。
- 在图形用户界面中,向一个文本区输入一个文件流,文本区加了滚动条,怎样使滚动条随着文件增多而滚动啊?
- while ((rf.read(buffer,0,n)!=-1) && (n>0))
- 高分求助在线等:java的XML解析器都有哪些?我用dom4j进行解析,为什么在jdk1.4下不需要提供解析器?
- 关于JTable中显示的问题,先谢谢了。急,在线等!
- 我的程序怎么回事,为什么不能编译通过?错在哪里?各位大侠帮帮忙啊!
- 如何打印n(为任意)位数的所有排列组合?救命
- java socket 多线程关闭问题
- 求助:关于RSS解析器的问题!
collection.两个都能被回收, 因为没有被其他对象引用了
23. snoog = null;
这句不是表示snoog没有引用了,为什么不能被回收呢?
另外两个在环内互相引用,为什么就能被回收呢?