This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "GC" Watch "GC" New topic
Author

GC

venkat ramana
Greenhorn

Joined: Dec 15, 2005
Posts: 11
I have a code

class C13
{
public static void main(String[] args)
{
C13 c1 = new C13();
C13 c2 = m(c1);
C13 c3 = new C13();
c2 = c3; // line 1

// here code is there
}
static C13 m(C13 obj)
{
obj = new C13();
return obj;
}
}
After line 1 how many obj are eligible to GC ?
Can You please explain ?
Krishna Latha Grandhi
Ranch Hand

Joined: Nov 08, 2005
Posts: 110
Only one object is available for garbage collection
vipul patel
Ranch Hand

Joined: Oct 16, 2005
Posts: 146
ya hari, only one object will be eligible.
 
 
subject: GC
 
Similar Threads
Garbage collection with immutable short.
Garbage collection doubt
how many objects will be eligible for garbage collection
help scjp5.0 question
Garbage Collection