title: Dynamic Method Binding in Java
body: <p>With this code</p>
  
  <pre><code>public static void doSomething(Animal arg)
  {
  ...
  }
  </code></pre>
  
  <p>Which one of the following is more correct? (They both compile and run fine.) Is there a difference?</p>
  
  <pre><code>public static void main(String[] args)
  {
  Animal fido = new Dog();
  doSomething(fido);
  }
  </code></pre>
  
  <p>or</p>
  
  <pre><code>public static void main(String[] args)
  {
  Dog fido = new Dog();
  doSomething(fido);
  }
  </code></pre>
  
  <p>I don't believe it matters, but is one more conventional? Thanks.</p>