This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Questions on Garbage Collections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Questions on Garbage Collections" Watch "Questions on Garbage Collections" New topic
Author

Questions on Garbage Collections

Nikhil Jain
Ranch Hand

Joined: May 15, 2005
Posts: 385
Hello Friends,

I find really confusing when I tried to solve questions like "How many objects are eligible at garbage collection". Can you please suggest me some trick

Secondly in question like

obj a=new Integer();
boj b=new Long();
a=null; ....1
a=b; ....2

Will the object a be eligible for gc at line 1?

thanks
shashank


SCJP 1.4, SCWCD 1.4, SCBCD 1.5
vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580

"How many objects are eligible at garbage collection". Can you please suggest me some trick



Use picture representation



Will the object a be eligible for gc at line 1?


After line 1 Object is eligible for GC
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Questions on Garbage Collections
 
Similar Threads
Garbage collection guarantees?
Garbage Collection
Garbage collection
Query on GC from KAM book
Garbage Collection Eligibility