Consider the following program:
class Overload {// www . jav a2 s .co m private Overload(Object o) { System.out.println("Object"); } private Overload(double [] arr) { System.out.println("double []"); } private Overload() { System.out.println("void"); } public static void main(String[]args) { new Overload(null); // MARKER } }
Which one of the following options correctly describes the behavior of this program?
c)
The overload resolution matches to the most specific overload.
When the argument null is passed, there are two candidates, Overload(Object) and Overload(double[]), and of these two, Overload(double[]) is the most specific overload, so the compiler resolves to calling that method.