I came across the following example recently
public class A
{
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[])
{
A question = new A();
question.method(null);
}
}
In the above case I found that the output is
---"String Version".
I just need to know the why the method(String) is called.
(I thought there would a ambiguity error.)