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,071
  • 10
  • 105
  • 92
Sushil Kumar Sah
  • 873
  • 9
  • 13

0 Answers0