Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Have a Question on this Question  RSS feed

 
Harish Tam
Ranch Hand
Posts: 71
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
was reading a book it had a question like this



when //do stuff is reached how many objects are eligible for GC
and the answer is 2 c1 object and a short object in c1

my Question over here is as per the above code should c3 be also eligible for GC ?
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only objects are eligible for garbage collection, not variables. And c3 is only ever set to null - there is no object created that can be garbage collected.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!