public class HelloWorld{
     public static void main(String []args){
        new SampleString().add(null);
     }
}
class SampleString{
    public void add(Object s){
        System.out.println("Inside Object method");
    }
    public void add(String s){
        System.out.println("Inside string method");
    }
}
Why does the program print "Inside string method" and not "Inside Object method" ? Can you please explain me the logic behind this ?
 
     
     
    