4
是在People
以下Java代码片段一个型名称(如T
或K
)或混凝土类(或接口)的名字吗?问题与Java泛型接口
public class Student implements Comparable<People> { ... }
我在哪里可以找到这样的问题的解释或规格?
是在People
以下Java代码片段一个型名称(如T
或K
)或混凝土类(或接口)的名字吗?问题与Java泛型接口
public class Student implements Comparable<People> { ... }
我在哪里可以找到这样的问题的解释或规格?
在这种情况下,People
是具体类的名称,而不是类型变量。如果你希望它是一个类型变量,你不得不说,Student
本身是一个通用的:
public class Student<People> implements Comparable<People> { ... }
顺便说一句,notationally,像T
和K
通配符是替身类通常称为类型变量而不是类型。
谢谢templatetypedef。 – 2011-01-12 18:55:46