A simple sample show generic interface usage

generic class is common so far, but generic interface is a little bit confused, the program below make concept clearly:

public interface Ia<E> {
    public void add(E element);
    public E get();
}

public interface Ib<T> extends Ia<T> {
    public void myString();
}

public class B<F> implements Ib<F>{

    public void myString() {

    }

    public void add(F element) {

    }

    public F get() {
        return null;
    }

    public static void main(String[] args) {
        B<String> myB = new B<String>();
        myB.toString();
    }

}

你可能感兴趣的:(F#)