maha anna:
i have gone through many of the previous forums regarding GC,
Actually I would like to get an answer to one.
as far as the certification goes.What should be the answer to
the following Q,
when will the obj ref by s be GC.
void meth()
{
1:
String s="vijay";
2: s=null;
3: String s="vijay1";
}
I understand that String literals are never candidates for garbage collection,So in this case line 2 is the correct answer or "vijay" will not be collected at all.remains alive till the class obj remains alive.
if the answer is line two,will such questions be involved in certification.