在下面的代码中,有多少对象在执行第7行后有资格进行垃圾回收? 在我看来,1个是z的对象是符合条件的。是对的?关于垃圾回收的困惑
public class Tester
{
public static void main(String[] args)
{
Integer x = new Integer(3000);
Integer y = new Integer(4000);
Integer z = new Integer(5000);
Object a = x;
x = y;
y = z;
z = null; //line 7
}
}
非常感谢。