So I have this:
class A{}
class B extends A {}
class C extends B {
    public String toString(){ return new String("C"); } 
    }
class D extends B {
    public String toString(){ return "D"; } 
    }
And then in main
List<A> list = Arrays.asList(new C(), new D());
        for (A a : list) {
            System.out.println(a.toString());
        }
I can compile this code and it prints: C D but on my friend's computer it won't compile. It has to deal with the Java version I am using ?
 
     
    