Tag: 含糊不清

Java 8中的模糊方法,为什么?

public static void main(String… args){ then(bar()); // Compilation Error } public static E bar() { return null; } public static void then(Throwable actual) { } public static void then(CharSequence actual) { } 编译结果(来自命令行javac Ambiguous.java ) Ambiguous.java:4: error: reference to then is ambiguous then(bar()); ^ both method then(Throwable) in Ambiguous and method then(CharSequence) in Ambiguous match […]