Topic: 一道scjp的题目! |
Print this page |
1.一道scjp的题目! | Copy to clipboard |
Posted by: AchillesA Posted on: 2005-07-16 19:32 QUESTION NO: 43 Given:
Which two statements are true after line 15, before main completes? (Choose two) A. Line 15 causes a stack overflow. B. An exception is thrown at runtime. C. The object referenced by a is eligible for garbage collection. D. The object referenced by b is eligible for garbage collection. E. The object referenced by a is not eligible for garbage collection. F. The object referenced by b is not eligible for garbage collection. 麻烦给解释下!头都想大了,谢谢! 看道上面的题目让我想到了一点,就是this和使用new 产生一个实例有什么不同? |
2.Re:一道scjp的题目! [Re: AchillesA] | Copy to clipboard |
Posted by: njluz Posted on: 2005-07-17 13:26 我的理解就选C,D 理由是虽然A,B互相应用,但是A,B却没有任何第三方正在活跃的类使用了,garbage collection的处理机制可以收集这种情况内存。 |
3.Re:一道scjp的题目! [Re: AchillesA] | Copy to clipboard |
Posted by: AchillesA Posted on: 2005-07-17 18:54 我的答案野生一cd 但是书上面给出的答案是c f |
4.测试一下 [Re: AchillesA] | Copy to clipboard |
Posted by: 西曼 Posted on: 2005-08-09 10:23
运行结果是: Object B Init ed. Object A Init ed. Calling System.gc()... DELETING Object A... DELETING Object B... 结果表明答案应该选CD |
5.Re:一道scjp的题目! [Re: AchillesA] | Copy to clipboard |
Posted by: aleel_008 Posted on: 2005-08-12 21:19 毫无疑问的问题, b is eligible for gc |
6.Re:一道scjp的题目! [Re: AchillesA] | Copy to clipboard |
Posted by: gavin_yue Posted on: 2005-10-24 19:41 答案应该是CD 这是一个GC的典型情况--隔离岛 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |