public interface 接口名<泛型表示符号>{}
举例:
public interface Student1<T> {T getName(T name);}
public class StudentImpl implements Student1<String>{@Overridepublic String getName(String name) {return name;}}
public class Test1 {public static void main(String[] args) {Student1<String> stu1 = new StudentImpl(); // 接口类型的实例化对象需要指定具体的数据类型,否则就是objectSystem.out.println(stu1.getName("爱摸鱼的TT~"));StudentImpl stu2 = new StudentImpl(); // 实现类类型的实例化对象就不需要指定具体的数据类型System.out.println(stu2.getName("爱摸鱼的TT"));}}
