java 泛型 泛型接口(Generic Interfaces)类型形参(Type Parameters)

接口的类型形参作用于整个接口,除了一些字段和嵌套类型,因为字段和嵌套类型都是默认静态

interface Interface <T> {
    
    
	T value; //error
    T method(); // methods
}

参考:
http://www.angelikalanger.com/GenericsFAQ/FAQSections/TypeParameters.html#FAQ301

猜你喜欢

转载自blog.csdn.net/claroja/article/details/114108633