aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes GC 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 "GC" Watch "GC" New topic
Author

GC

Srinivas Katta
Ranch Hand

Joined: Feb 01, 2007
Posts: 76
Hi,

I have executed the below program for K&B Book Chapter 3 and attached the Diagram of my understanding


Could you Please explain how many objects will be eligible for garbage collection when line marked as //dostuff is reached?

Thanks
Srinivas


[Thumbnail for Garb.JPG]

Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9303
    
  17

This question has been discussed a lot of times before (search for "alpha beta"). See these threads

http://www.coderanch.com/t/481398/Programmer-Certification-SCJP/certification/many-eligible-gc
http://www.coderanch.com/t/474980/Programmer-Certification-SCJP/certification/Garbage-Collection-Clarification
http://www.coderanch.com/t/469606/Programmer-Certification-SCJP/certification/Garbage-Collection


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Harshit Sethi
Ranch Hand

Joined: Jul 16, 2010
Posts: 75
Only one object is eligible and that is object that was referred by a1 before it was set to null.
Harshit Sethi
Ranch Hand

Joined: Jul 16, 2010
Posts: 75
This is the proper diagram,i used paint so its not that tidy,but still you can get what you want from this diagram.

link to image
Harshit Sethi
Ranch Hand

Joined: Jul 16, 2010
Posts: 75
Someone tell me how to upload image here?
Mahmoud Hossam
Ranch Hand

Joined: Feb 20, 2010
Posts: 74

Harshit Sethi wrote:Someone tell me how to upload image here?


click on "attachments" button below the text pane,then select the file(s) you want to upload

The files cannot be larger than 1024KB,and you can't upload more than 3 files per post
Harshit Sethi
Ranch Hand

Joined: Jul 16, 2010
Posts: 75
Here it is finally....



[Thumbnail for Untitled.jpg]

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: GC