【发布时间】:2014-03-04 03:10:27
【问题描述】:
public class MyClass<Integer> extends AnotherOne<Integer> {
public MyClass(HashSet<Integer> ar) {
super(ar);
}
}
AnotherOne 是一个抽象(通用)类,它有一个以HashSet<T> 作为参数的构造函数。然后它有另一种方法,它使用T 类型作为其参数。
一切正常,但我必须使用Integer 作为参数来覆盖该方法,并且使用Integer 而不是int 似乎很奇怪。有没有办法使用原始 int?
【问题讨论】:
-
有什么问题吗?
-
@Leo 如果值得告诉,请在答案中填写?
标签: java generics inheritance abstract-class hashset