How is ambiguity in selecting from overloaded methods resolved in java?
<p>I have a question.</p>

<pre><code>package org.study.algos;
public class Study {

    public static void main(String[] args) {
       A a = new A();
       a.m1(null);
    }
 }
 class A {
    public void m1(String s) {
       System.out.println("String");
        System.out.println(s);
    }
    public void m1(Object obj) {
       System.out.println("Object");
       System.out.println(obj);
    }
}
</code></pre>

<p>Here, the output is </p>

<blockquote>
  <p>String
  null</p>
</blockquote>

<p>Why does the JVM resolve the method to one with a String argument?</p>

<p>Thanks in advance 
J</p>
