【发布时间】:2016-05-04 07:48:50
【问题描述】:
class Value {
public void method1(List<Integer> intList) {
}
public void method1(List<Double> doubleList) {
}
}
以上两种方法都不能使用函数重载。
看起来这两种方法都将List 作为参数。
有没有办法区分 Lists 数据类型的参数?
这是错误信息:
Erasure of method method1(List<Integer>) is the same as another method in type Value
还有其他方法可以在这里使用重载吗?
【问题讨论】:
标签: java overloading