Why this behavior in overloading
<p>When I run this program why it is calling method overloaded with string parameter.</p>

<pre><code>public class StaticBindTest {

    public static void main(String args[])  {
       StaticBindTest et = new StaticBindTest();
       et.sort(null);

    }

    //overloaded method
    public void sort(Object c){
        System.out.println("Inside Collection sort method");
    }


   //another overloaded method
    public void sort(String hs){
        System.out.println("Inside HashSet sort method");
    }

}
</code></pre>

<p>In case if I re-write my method as</p>

<pre><code>    public void sort(String hs){
        if(hs instanceof String)
        System.out.println("Inside HashSet sort method");
    }
</code></pre>

<p>It will display blank console, which means it is not a instance of String then why it call in this manner?</p>
