title: Java A bit confused with Polymorphic concept in Java
body: <p>Example program:</p>
  
  <pre><code>class Animal {
    public void eat() {
      System.out.println(" Animal eats");
    }
    class Dog extends Animal {
      public void eat(String s) {
        System.out.println(" Dog eats" + s);
      }
      public class Demo {
        public static void main(String args[]){
          Animal a = new Dog();
          Dog d = (Dog) a;
          a.eat();         
          d.eat("Meat");
        }
      }
  </code></pre>
  
  <p>My question is why <code>a.eat("Meat")</code> is not reachable? Since <code>a</code> is Object during the time it's referring to Dog Object, it should allow to call <code>eat("meat")</code>.</p>
  
  <p>Can anyone clarify where am I going wrong?</p>