hi everybody,
public class AQuestion
{
public void method(Object o)
{
System.out.println("Object Verion");
}
public void method(
String s)
{
System.out.println("String Version");
}
public static void main(String args[])
{
AQuestion question = new AQuestion();
question.method(null);
}
}
This is the program.It is giving output as String version. I thought it will give compiletime error,bcoz of ambiguity.
Can anyone explain the reason why it is giving string version.? why isnt calling the method with Object as argument?