Write a java program to implement method overriding | VCMIT

by - March 13, 2020

Method Overriding



INPUT

class Human{
 
   public void eat()
   {
      System.out.println("Human is eating");
   }
}
class Boy extends Human{
 
   public void eat(){
      System.out.println("Boy is eating");
   }
   public static void main( String args[]) {
      Boy obj = new Boy();
   
      obj.eat();
   }
}

OUTPUT



You May Also Like

0 Comments