aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Ques from Self Test in Chap3/K&B 5 ,page 266  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 "Ques from Self Test in Chap3/K&B 5 ,page 266  " Watch "Ques from Self Test in Chap3/K&B 5 ,page 266  " New topic
Author

Ques from Self Test in Chap3/K&B 5 ,page 266

Lucky J Verma
Ranch Hand

Joined: Apr 11, 2007
Posts: 278
Hi
this is question# 2 from self test in K & B SCJP 5 book.
It is on Garbage collection when // do stuff is reached ,how many objects are eligible for GC.

I think it should be 4( c1,c2) but answer is 2 (c1) .Please suggest me how.

Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9303
    
  17

This question has been asked many times. Go through these threads to see if you understand it

http://www.coderanch.com/t/463776/Programmer-Certification-SCJP/certification/SCJP-Java-Garbage-Collection
http://www.coderanch.com/t/458122/Programmer-Certification-SCJP/certification/object-eligible-GC
http://www.coderanch.com/t/455697/Programmer-Certification-SCJP/certification/many-objects-are-eligible-GC
http://www.coderanch.com/t/417925/Programmer-Certification-SCJP/certification/K-B-SCJP-Chapter-Q

Also if you are confused as to why c2 is not eligible for GC, then read this...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Harry Henriques
Ranch Hand

Joined: Jun 17, 2009
Posts: 206
The following reference explains quite clearly why there is confusion concerning the answer to the SCJP SelfTest question in K&B SCJP5 Study Guide.

Ankit Garg wrote:Also if you are confused as to why c2 is not eligible for GC, then read this...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ques from Self Test in Chap3/K&B 5 ,page 266