posted 23 years ago
Hi,
SAMPLE QUESTION 3:
1.public class X {
2. public void m(Object x) {
3. x = new Integer(99);
4. Integer y = (Integer)x;
5. y = null;
6. System.out.println("x is" + x);
7. }
8.}
When is the Integer object, created in line 3, eligible for garbage collection?
1.never
2.just after line 4
3.just after line 5
4.just after line 6 (that is, as the method returns)
5.when the calling method sets the argument it passed intothis method to null
Answer: 4
Mukti
[This message has been edited by Mukti Bajaj (edited January 22, 2001).]