对于下面的代码,我确实理解调用方法不明确要调用哪个重载方法是有意义的,但是我无法理解此处如何准确检查参数匹配。
public class Test{
public void m1(float i,int j){
System.out.println("float method ");
}
public void m1(int i, float j){
System.out.println("int method ");
}
public static void main(String[] args) {
Test a=new Test();
a.m1(10,10); // The method m1(float, int) is ambiguous for the type Test
}
}
Run Code Online (Sandbox Code Playgroud)