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() {
r = r+1; //1
r = null; //2
s = s + r; //3String r = new
String("abc");
String s = new String("abc");
} //4
a.Before statement labeled 1
b.Before statement labeled 2
c.Before statement labeled 3
d.Before statement labeled 4
e.Never.
The answer is d. But I think it should b. Because the two statements String r = new String("abc");String s = new String("abc");, the two "abc" is refer to different memory.The statement:r=r+1 lets r refer to a different memory, so I think the one of the "abc" should be collected.