Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GC

 
venkat ramana
Greenhorn
Posts: 11
  • 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
  • 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
  • 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