posted 23 years ago
Given the following: (paraphrased from a sample on the sun site)
1.public class X {
2.int w = 1;
3.public void m(Object x) {
4. w = 4;
//(edited)
6. x = new Integer(99);
7. Integer y = (Integer)x;
8. y = null;
9. System.out.println("x is" + x);
10. }
11.}
Is it correct to say that y is eligible for garbage collection after line 8. Is it also correct that x is eligible for garbage collection after line 10 (because it is out of scope).
[This message has been edited by Gerry Timmermans (edited December 20, 2000).]