garbage collector Issue
        Posted  
        
            by 
                Eslam
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Eslam
        
        
        
        Published on 2012-09-02T09:23:25Z
        Indexed on 
            2012/09/02
            9:38 UTC
        
        
        Read the original article
        Hit count: 327
        
this question is like my previous one Given:
3. interface Animal { void makeNoise(); }
4. class Horse implements Animal {
5.   Long weight = 1200L;
6.   public void makeNoise() { System.out.println("whinny"); }
7.   }
8.   public class Icelandic extends Horse {
9.     public void makeNoise() { System.out.println("vinny"); }
10.    public static void main(String[] args) {
11.    Icelandic i1 = new Icelandic();
12.    Icelandic i2 = new Icelandic();
13.    Icelandic i3 = new Icelandic();
14.    i3 = i1; i1 = i2; i2 = null; i3 = i1;
15.  }
16. }
When line 14 is reached, how many objects are eligible for the garbage collector?
A. 0
B. 1
C. 2
D. 3
E. 4
F. 6
i choosed A but the right answer is E, but i don't know Why?
© Stack Overflow or respective owner