Not from actual exam ... Question: Given the following code - when is String s eligible for garbage collection? Line 1. public void test() { Line 2. String s = new String("Hello"); Line 3. s = null; Line 4. System.out.println(s); Line 5. } Thanks.
I am assuming that the question is about the "hello" string which was represented by s. I would have answered it as - anytime after line 3 [This message has been edited by Mary Anitha (edited October 24, 2000).]