Method Overloading for NULL parameter
- by Phani
I have added three methods with parameters:
public static void doSomething(Object obj) {
System.out.println("Object called");
}
public static void doSomething(char[] obj) {
System.out.println("Array called");
}
public static void doSomething(Integer obj) {
System.out.println("Array called");
}
When I am calling doSomething(null) , then compiler throws error as ambiguous methods. So Is the issue because Integer and char[] methods or Integer and Object methods?