• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Have a Question on this Question

 
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: 4566
8
  • 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