Interview Questions

What will be the output of the following program?

public class Test {
 
        public int test(int a, float b){
               
                return 0;
        }
       
        public float test(float a,int b){
               
                return 1;
        }
       
        public static void main(String[] args)
        {
                Test t = new Test();
                t.test(10, 20);
        }
}

Output:

Compilation Error: the method test(int,float) is ambiguos for the type Test.

The above code violates one of the rules of overloading that there cannot be two methods
with same name & same number of argument types.