title: Static Binding and Dynamic Binding
body: <p>I am really confused about dynamic binding and static binding. I have read that determining the type of an object at compile time is called static binding and determining it at runtime is called dynamic binding.</p>
  
  <p>What happens in the code below:</p>
  
  <p>Static binding or dynamic binding?<br>
  What kind of polymorphism does this show?</p>
  
  <pre><code>class Animal
  {
      void eat()
      {
          System.out.println("Animal is eating");
      }
  }
  
  class Dog extends Animal
  {
      void eat()
      {
          System.out.println("Dog is eating");
      }
  }
  
  public static void main(String args[])
  {
      Animal a=new Animal();
      a.eat();
  }
  </code></pre>