This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Garbage colln question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Garbage colln question" Watch "Garbage colln question" New topic
Author

Garbage colln question

Dinesh Tahiliani
Ranch Hand

Joined: Aug 06, 2007
Posts: 486
class Eco
{
public statci void main(String []s)
{
Eco e1= new Eco();
Eco e2= new Eco();
Eco e3= new Eco();
e3.e = e2;
e1.e = e3;
e2.e1=e1;
e1=null;
e2=null;
e3=null;
}
Eco e;
}

Ranchers,

How many objects are eligible for gc?
According to me all three objects,bcoz all have been assigned null.

Correct me if ia m wrong?


Thanks<br />Dinesh
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37884
    
  22
Won't compile. You have copied something wrongly. And you have already been reminded to use the code tags.
Karl Prenton
Ranch Hand

Joined: Mar 10, 2008
Posts: 51
to be frank
the fact that the references have been nulled is irrelevant the program terminates so they all get GC!
you need to ask the right question...
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Dinesh,

You've also been asked to use real words when posting to JavaRanch.
"bcoz and "colln" are not words in the English language.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Dinesh Tahiliani
Ranch Hand

Joined: Aug 06, 2007
Posts: 486
I will take care.
The question is fron KB
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Garbage colln question
 
Similar Threads
garbage collection
Garbage Collection question
How can we determine whether an object's reference variable is null or not?
garbage collection
Islands of isolation