title: what is the reason for the following output of overloaded function?
body: <p>I was asked the output of this question in an interview, though I answered correctly I am not able to figure out the exact reason</p>
  
  <pre><code>class Main{
  
      void hello(Object obj)
      {
          System.out.println("i am object");
      }
  
      void hello(String str)
      {
           System.out.println("i am String");
      }
  
      public static void main(String[] args)
      {
          Main m = new Main();
          m.hello(null);
      }
  }
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code>i am String
  </code></pre>