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

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