I fail to understand that why in the following code the output is "String Version". As everything is Derived from Object then why it matches to String version?
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[]) throws Exception
{
AQuestion question = new AQuestion();
question.method(null);
}
}
Output: String Version