hi all,
this is taken from javaprepare mock exam. pls explain what is the answer and why-
At what stage in the following method does the object initially referenced by s becomes available for garbage collection. Select the one correct answer.
void method X() {
String r = new String("abc");
String s = new String("abc);
r = r+1; //1
r = null; //2
s = s + r; //3
} //4
r and s are references to 2 different string objects b'cos they are created using "new". am i right?