public class Class1 {
public void method(Object obj){
System.out.println("Object");
}
public void method(String str){
System.out.println("String");
}
public static void main(String... arg){
new Class1().method(null);
}
}
as per JVM it will call to most specific argument type in this case most specific is String so method call happen to string argument type,but we need to call method of Object argument type