Interface Generic (Has compile error) : Generic Interface « Generics « Java






Interface Generic (Has compile error)


import java.util.*;

interface BaseInterface<A> {
    A getInfo();
}

class ParentClass implements BaseInterface<Integer> {
    public Integer getInfo()
    {
        return(null);
    }
}

class ChildClass extends ParentClass implements BaseInterface<String> { }

public class BadParents {
    public static void main(String args[])
    {
        Vector<Integer> v1 = new Vector<Integer>();
        Vector v2;

        v1 = v2;
        v2 = v1;
    }
}


           
       








Related examples in the same category

1.A generic interface example. A generic interface example.