鉴于:
interface Animal {
void makeNoise();
}
class Horse implements Animal {
Long weight = 1200L;
public void makeNoise() {
System.out.println("whinny");
}
}
public class Icelandic extends Horse {
public void makeNoise() {
System.out.println("vinny");
}
public static void main(String[] args) {
Icelandic i1 = new Icelandic();
Icelandic i2 = new Icelandic();
Icelandic i3 = new Icelandic();
i3 = i1;
i1 = i2;
i2 = null;
i3 = i1;
System.out.println("end of program");
}
}
在最后一条语句中有多少对象符合垃圾收集器的条件(即:在哪里打印程序结束)?答案是 4 但我不明白它们是 4 并且最多有 3 个对象?