Java uses early binding to determine which method to call, but here my question is how is it determining that it should call
private static void confuse(RuntimeException object)
not the other two methods ?
/**
* @param args
*/
public static final void main(String[] args) {
confuse(null);
}
private static void confuse(Object object) {
System.out.println("object");
}
private static void confuse(RuntimeException object) {
System.out.println("RuntimeException ");
}
private static void confuse(Exception object) {
System.out.println("Exception ");
}
if I am calling confuse using null it should give compilation error, as null can be the value for all three classes. Please explain the output.