Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Questions on Garbage Collections

 
Nikhil Jain
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
vidya sagar
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

"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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic