aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes How many objects are eligible for GC? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "How many objects are eligible for GC?" Watch "How many objects are eligible for GC?" New topic
Author

How many objects are eligible for GC?

Kamil Wojcik
Ranch Hand

Joined: May 19, 2008
Posts: 78

Hi,

SOURCE: SCJP K. Sierra & B. Bates (Self Test: chapter: 3 question: 1)



When // do Stuff is reached, how many objects are eligible for GC?

Answer is 2 - Only one CardBoard object (c1) and associated Short wrapper object.

My question is why object c3 is not eligible?


SCJP 6.0 Passed | SCWCD Passed | PSM in progress...
Palash Kumar
Ranch Hand

Joined: Jul 21, 2009
Posts: 33

i think there is no object to which c3 is referring...
c3 is just a "reference variable" having value NULL


SCJP 6 with 80%, going for SCWCD
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

because c3 is... not an object It's only a null reference


SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
Kamil Wojcik
Ranch Hand

Joined: May 19, 2008
Posts: 78

Thank You for replay, You are right! I've missed that c3 is not an Object
Abhijeet Pathak
Ranch Hand

Joined: Jul 05, 2009
Posts: 33
Thank you Kamil for asking my query.
Thank you Lucas for solving it for us.


I am the one who knows that I don't know anything.
Abhijeet
 
wood burning stoves
 
subject: How many objects are eligible for GC?