8 Comments


  1. It will not compile. It gives compile-time error ” The method getValue(Integer) is ambiguous for the type Object”

    Reply
  2. sunil

    Anything that can be the value of an Integer type will call the getValue(Integer x) method and for all the other values it will call to getValue(Object x) method.

    Reply
  3. mudit

    It will be exception because both integer or object can be null.

    Reply

    • No Mudit, you can try running the program..

      Reply
  4. Daniel Couillard

    NullPointerException?

    Reply
    • admin

      No, it won’t be an exception.. this is an example of method overloading.. its just about deciding which of the methods will be chosen for a parameter NULL.

      Click on Start quiz button to answer the quiz and see the correct answer.

      Reply

Leave a Reply.. code can be added in <code> </code> tags