Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Questions on Garbage Collections  RSS feed

 
Nikhil Jain
Ranch Hand
Posts: 392
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!