This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills: The software developer's life manual and have John Sonmez on-line!
See this thread for details.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GC

 
venkat ramana
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 110
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only one object is available for garbage collection
 
vipul patel
Ranch Hand
Posts: 146
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya hari, only one object will be eligible.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic