title: JAVA Object/String method overload
body: <p>Just out of curiosity I tried this example.</p>
  
  <pre><code>public class Class1 {
  
      public void method(Object obj){
          System.out.println("Object");
      }
  
      public void method(String str){
          System.out.println("String");
      }
  
      public static void main(String... arg){
          new Class1().method(null);
      }
  
  }
  </code></pre>
  
  <p>The output being "String". I want to know on what basis the JVM decides to invoke method taking String as argument and not Object.</p>