Following code was successfully compiled
class Overloading{
public static void aMethod (double val1, long val2) {
System.out.println ("double, long");
}
public static void aMethod (int val1, long val2) {
System.out.println ("int, long");
}
public static void main(String[] args) {
aMethod(9, 10);
}
}
But when method signature was changed
From this
aMethod (double val1, long val2)
To this
aMethod (double val1, int val2)
compilation time error was occured
Overloading.java:12: error: reference to aMethod is ambiguous, both method aMeth
od(double,int) in Overloading and method aMethod(int,long) in Overloading match
aMethod(9, 10);
^