Four objects would be eligible for gc only if i1, i2, i3 and i4 are assigned null value. In the above example i1,i2,i3 are making a loop, but since they are not null, they are still reachable and thus not eligible for gc. i4 has a self referencing loop. Therefore if i4 were assigned to null, it would be eligible for gc too.
the real exam will list a line number associated with such questions - so for instance this question should say something like "after the line that invokes m1() completes"... otherwise the answer is often different depending on where in the code you look.
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
after m1 completes, objects originally referenced by i1,i2,i3,i4 will be elegible for GC. (i1,i2,i3 and i4 are local variables of m1() and nothing outside objects referenced by i1,i2,i3,i4 references these objects)
(i4 - after m1() finished, the object is only referenced from itself and so it is unreachable.)
After line new J().m1() also the J object will be elegible for GC - its reference is not stored in any variable.