package demo02;
public interface GenericInterface<I> {
public abstract void method(I i);
}
package demo02;
public class GenericInterfaceImpl implements GenericInterface<String> {
@Override
public void method(String s) {
System.out.println(s);
}
}
package demo02;
public class GenericInterfaceImpl2<I> implements GenericInterface<I> {
@Override
public void method(I i) {
System.out.println(i);
}
}
package demo02;
public class Demo01GenericInterface {
public static void main(String[] args) {
GenericInterfaceImpl g1=new GenericInterfaceImpl();
g1.method("哒哒哒");
System.out.println("--------------");
GenericInterfaceImpl2<Integer> g2=new GenericInterfaceImpl2<>();
g2.method(100);
}
}