Given:
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");
}
}
how many objects are eligible for the garbage collector at the last statement (ie:where printing end of program)? The answer is 4 but i did not understand How they are 4 and there are at max 3 objects?