[求助]有关垃圾回收的问题
1. class text {
2. private Domo d;
3. void start() {
4. d = new Demo();
5. this.takeDemo(d);
6. }
7.
8. void takeDemo(Demo demo) {
9. demo = null;
10. demo = new Demo();
11. }
12. }
When is the Demo object, created on line 3 ,eligible for garbage collection?
第3行产生的Demo对象何时符合垃圾回收条件?
A. After line 5. 5行后
B. After line 9. 9行后
C. After the start() method completes. start()方法结束后
D. When the takeDemo() method completes. takeDemo()方法完成时
E. When the instance running this code is made eligible for garbage collection. 当代码中的实例被执行的时候
应该选择什么呢?为什么?
B选项为什么不对?