我对 Java 中的泛型编程有一个小问题。有没有办法检查传递给方法的参数的类型?我想比较调用该方法的实例的类型以及传递给它的参数。
如果它们不相同,则应停止该方法的操作(保护种类)。
public void homeMatch(SportTeam<Type> visitors){
if(the type of visitors and this-object are not the same){
//do this
}
else{
//do something different
}
}
FFIVE
守着一只汪
凤凰求蛊
相关分类