Hi, I have a doubt when i pass null as an argument to an overloaded method as in the following code
public void method1(Object o){
System.out.print("Inside Object");}
public void method1(
String s){
System.out.print("Inside String");}
static void main (String[]args){
method1(null);}
When this is executed inside string gets printed.
Now if i change the code as follows
public void method1(StringBuffer o){
System.out.print("Inside Object");}
public void method1(String s){
System.out.print("Inside String");}
static void main (String[]args){
method1(null);}
now i get a compile time error complaining of ambuiguity.
is it that if a superclass type is present then the code compiles