1
class Test {
    public void method(Object o) {

        System.out.println("Object");
    }


    public void method(Test s) {

        System.out.println("Test");
    }


    public static void main(String as[]) {

        Test ob = new Test();

        ob.method(null);
    }

}

Q. Why is the output "test" ? How null is getting passed over here and why?

A--C
  • 36,351
  • 10
  • 106
  • 92
Sushil Kumar Sah
  • 1,042
  • 10
  • 13

0 Answers0