title: Java program with different classes with same method name in case of inheritance
body: <pre><code>class GrandFather
  {
      void display1()
      {
          System.out.println("I am grandfather");
      }
  }
  
  class Father extends GrandFather
  {
      void display()
      {
          System.out.println("I am father");
      }
  }
  
  class Children extends Father
  {
      void display()
      {
         System.out.println("I am Child");
      }
  
      public static void main(String []args)
      {
         Children obj = new Children();
  
         obj.display();
         obj.display();
         obj.display();
      }
  }
  </code></pre>
  
  <p>When I am compiling this code it is printing the display method of last class so tell me how to cast it to print the display of parent and other class</p>