aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Have a Question on this Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Have a Question on this Question" Watch "Have a Question on this Question" New topic
Author

Have a Question on this Question

Harish Tam
Ranch Hand

Joined: Feb 17, 2005
Posts: 71

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 ?

SCJP 1.4, SCWCD 1.4
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4464
    
    8

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.
 
 
subject: Have a Question on this Question