-1

**class A {

}

class B extends A{
    
}

public class App 
{
    public void show(B o) {
        System.out.println("Object");
    }
    
    public void show(A o) 
    {
         System.out.println("String");
    }
    

    public static void main( String[] args )
    {
        App app = new App();
        app.show(null);
    }
}

*Output : Object *

I am not able understand the why output is String and not Obejct. As null value can be possible for both the object class

0 Answers0