Hi,
X x=new X(); //This object has a reference at the end of line 6
X x2=m1(x); //An object is returned from the method and x2 holds the
//reference
X x4=new X(); //This object has a reference at the end of line 6
x2=x4;//6 //x2 is relinquishing its reference to the original object
// and is pointing to the object stored in x4
//Remember that you are creating objects using new operator...
So at the end of line 6 you have one object (orginally created by the method execution ) that doesnt have any reference & ...so can be "GC"ed...
Regards
