dout regarding garbage collection
posted 20 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
hai ,
Here i am thinking answer is c is it right plz explain?
Here i am thinking answer is c is it right plz explain?
posted 20 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
How about A?
Mark
Mark
posted 20 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
But you know what, I think combining String Objects and a question about Garbage Collection together is just mean. It ends up asking about two seperate things.
1. Garbage Collection
2. Which Strings are in the String Pool and which are Objects on the heap.
Mark
1. Garbage Collection
2. Which Strings are in the String Pool and which are Objects on the heap.
Mark
posted 20 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
b) 1 --> "Nick" is the only object which does not have a stack variable reference pointing to it. The other Strings have references to them.
Rubens Gomes<br />SCJP 1.4 (96%)<br /><a href="http://www.rubens-gomes.com" target="_blank" rel="nofollow">www.rubens-gomes.com</a>
posted 20 years ago
I think it should be 2 ....
name and "Nick" string object lost
am i wrong?
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
String name;
String newName = "Nick";
newName = "Jason";
name = "Frieda";
String newestName = name;
name = null;
//Line A
I think it should be 2 ....
name and "Nick" string object lost
am i wrong?
/** Code speaks louder than words */
posted 20 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I think
< (b) 1 > is correct.
As there were only 3 objects and 2 are being referenced.
So its "NICK" which is eligible for garbage collection.
further u can't take name as object its only reference variable.
< (b) 1 > is correct.
As there were only 3 objects and 2 are being referenced.
So its "NICK" which is eligible for garbage collection.
further u can't take name as object its only reference variable.
Regards<br /> <br />Arvind Giri<br />MCA,SCJP 1.4,SCWCD 1.4<br />Looking for SCDJWS
Shivani Chandna
Ranch Hand
Posts: 380
posted 20 years ago
Right if newestName didnt refer to the object refer by name then doing name=null wd make 2 objects elegible for GC. Thanks !
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Originally posted by Arvind Giri:
[QBfurther u can't take name as object its only reference variable.[/QB]
Right if newestName didnt refer to the object refer by name then doing name=null wd make 2 objects elegible for GC. Thanks !

/** Code speaks louder than words */
posted 20 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
For what its worth, I agree with Rubens and Arvind. "Nick" appears to be the only String object not referenced.
Are we right? Can I have my certificate now?

Are we right? Can I have my certificate now?

| knowledge is the difference between drudgery and strategic action -- tiny ad The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |











