SCJP考题一道:垃圾回收时机

kurt17 kurt17 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
Given:
11. public void genNumbers() {
12. ArrayList numbers = new ArrayList();
13. for (int i=0; i<10; i++) {
14. int value = i * ((int) Math.random());
15. Integer intObj = new Integer(value);
16. numbers.add(intObj);
17. }
18. System.out.println(numbers);
19. }


Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for
garbage collection?
A. Line 16
B. Line 17
C. Line 18
D. Line 19
E. The object is NOT a candidate for garbage collection.


请问这道题应该怎么分析啊,循环与ArrayList如何影响Object的引用啊。问都不知道该怎么问啊。
请高手赐教。分不多啦。请多包涵啊。等以后有分了一定慷慨。
有哪位好心网友愿意给几个分的,在下先谢过了。
...全文
评论 4
收藏 已收藏
分享
返回顶部
kurt17
非技术区 23,404 成员 70,506 内容