Confusing method overloading in Java
<p>Following is the code relevant to <strong>constructor overloading</strong> in Java. Let's have a look at it.</p>

<pre><code>package temp;

final public class Main
{
    private Main(Object o)
    {
        System.out.println("Object");
    }

    private Main(double[] da)
    {
        System.out.println("double array");
    }

    public static void main(String[] args)throws Exception
    {
        Main main = new Main(null);
    }
}
</code></pre>

<hr>

<p>In the above code, constructors are being overloaded in which one has a formal parameter of type Object and the other has the formal parameter of type double (array).</p>

<hr>

<pre><code>Main main = new Main(null);
</code></pre>

<p>One of the constructors is being invoked by the above statement which is using a <strong>null</strong> value as it's actual argument and the program is displaying the output <strong>double array</strong> on the console. How does the compiler resolve a specific constructor (or a method, if such is a case) dynamically at run time in such a situation?</p>
