我想知道Eclipse中的错误信息是什么意思:
The constructor Case(Problem, Solution, double, CaseSource) is ambiguous
最佳答案
当您尝试实例化一个可以应用于多个构造函数的类时,就会出现问题。
例如:
public Example(String name) {
this.name = name;
}
public Example(SomeOther other) {
this.other = other;
}
如果您使用 String 对象调用构造函数,则有一个明确的构造函数。然而,如果你实例化 new Example(null)
那么它可能适用于任何一个,因此是模棱两可的。
这同样适用于具有相似签名的方法。
关于java - "The constructor ... is ambiguous"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5636320/