In your methods, you have (int, float) and (float, int) parameters, but when you call the method, you pass int (1,1) values. Java-complier can automatically type float in int if necessary. But in this case, the compiler cannot solve the automatic cast type, which int floats. Therefore, it shows ambiguity.
You need to call it test.add(1f, 1); or test.add(1,1f); ie indicate which value is int and which value is float.
PS To specify a value for float, you can write f with it.
gprathour
source share