Forums Register Login

how many objects are eligible for garbage collection?

+Pie Number of slices to send: Send
class C
{
public static void main(String a[])
{
C c1=new C();
C c2=m1(c1);
C c3=new C();
c2=c3; //6
anothermethod();
}
static C m1(C ob1){
ob1 =new C();
return ob1;
}
}
I think 1 objects are eligible for garbage collection, but answers is 2 objects and no explanation.
I want to know explanation, please explain...
+Pie Number of slices to send: Send
Welcome to the Ranch!

Please QuoteYourSources - where did you find this question?
+Pie Number of slices to send: Send
 

Jesper de Jong wrote:Welcome to the Ranch!

Please QuoteYourSources - where did you find this question?



I found this question from this link >>>http://examsguide.com/scjp/freequestions2.html
+Pie Number of slices to send: Send
This question was discussed a few days ago. They seem to agree with you (as do I).
machines help you to do more, but experience less. Experience this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 507 times.
Similar Threads
Doubt - Reg: GC
need help with garbage collector
garbage collection
Garbage Collection
help in garbage collection question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 07:33:18.