This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes GC , thread 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 , thread" Watch "GC , thread" New topic
Author

GC , thread

Rajiv Goyal
Greenhorn

Joined: Jul 28, 2003
Posts: 25
Hi,
-Can you please elaborate as when an object is eligible for garbage collectionc , i find it bit hard(with eg if possible).Any good link for the same?
-please send me good link related with threads and exception
thanks,
rajiv
[ August 26, 2003: Message edited by: Rajiv Goyal ]
Marcus Green
arch rival
Rancher

Joined: Sep 14, 1999
Posts: 2813
http://www.jchq.net/certkey/0301certkey.htm


SCWCD: Online Course, 50,000+ words and 200+ questions
http://www.examulator.com/moodle/course/view.php?id=5&topic=all
Dhanashree Mankar
Ranch Hand

Joined: Aug 25, 2003
Posts: 123
object is eligible for gc when all it's references are set to null.
for e.g.

String str = new String("hi");//1
String str1= str;//2
str=null;//3
:
://some processing with str1
:
:
str1=null;//4

Here we have created a new object str which contains a string "hi"
now we r assigning that to str1. so now there r 2 references to string "hi".
So unless and until u are not making both str and str1 to null that object is not eligible for garbage collection.
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
object is eligible for gc when all it's references are set to null.
hmm.. not necessarily. Objects are eligible for garbage collector when there's no live thread that can reach that object.


I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
 
GeeCON Prague 2014
 
subject: GC , thread