How javac (java compiler) finds the errors in respect to ambiguity and generates errors in compile time itself ?
how the compiler finds that we are passing a null value before execution
public class Ambiguity {
public static void main(String[] args) {
Ambiguity test = new Ambiguity();
test.overloadedMethod(null);
}
void overloadedMethod(IOException e) {
System.out.println("1");
}
void overloadedMethod(FileNotFoundException e) {
System.out.println("2");
}
void overloadedMethod(Exception e) {
System.out.println("3");
}
void overloadedMethod(ArithmeticException e) {
System.out.println("4");
}
}