Hi Guys/Gals
Which objects are eligible for garbage collection after method m1 returns?
class I {
private I other;
public void other(I i) {other = i;}
}
class J {
private void m1() {
I i1 = new I();
I i2 = new I();
I i3 = new I();
i1.other(i3);
i2.other(i1);
i3.other(i2);
}
public static void main (
String[] args) {
new J().m1();
}
}
Dans answer is i1 i2 i3 ,however I think since all of the objects are being refered by other and non of these are not isolated islands of references ,non is eligible
Any comments?