class C
{
public static void main(String args[])
{
C c1 = new C();
C c2 = m1(c1);
C c3 = new C();
c2 = c3; //6
anothermethod() ;
}
static C m1(C ob1)
{
ob1 = new C();
return ob1;
}
}
After line 6, how many objects are eligible for garbage collection?
Ans: 2
Please tell me as to what are those two objects here and how?
Thanks in advance...
{
public static void main(String args[])
{
C c1 = new C();
C c2 = m1(c1);
C c3 = new C();
c2 = c3; //6
anothermethod() ;
}
static C m1(C ob1)
{
ob1 = new C();
return ob1;
}
}
After line 6, how many objects are eligible for garbage collection?
Ans: 2
Please tell me as to what are those two objects here and how?
Thanks in advance...
Comment