class I {
private String name;
public I(String s) {name = s;}
private I other;
public void other(I i) {other = i;}
}
class J {
private I i1 = new I("A"), i2 = new I("B"), i3 = new I("C");
private void m1() {
i1.other(i2); i2.other(i1); i3.other(i3);
i1 = i3; i2 = i3;
m2();
}
private void m2() {/* Do amazing things. */}
public static void main (String[] args) {
new J().m1();
}}
Which of the three objects, A, B or C, is not eligible for garbage collection when method m2 begins to execute?
a. A
b. B
c. C
d. None of the above
Given answer is 'c', I am not satisfied.
Please help!!!
Regards,
cmbhatt