Hi,
At what stage in the following method does the object initially referenced by s becomes available for garbage collection.
void X() {
String r = new String("abc");
String s = new String("abc");//obj
r = r+1; //1
r = null; //2
s = s + r; //3
} //4
The answer for this question is that theobject labelled 'obj'is garbage collected Before statement labeled 4.
Please anyone explain me the solution of the above code.
Mathangi....