This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP 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