Overriding in java

In any object-oriented programming language, Overriding is a feature that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its super-classes or parent classes.
It is also called dynamic polymorphism.

Let us see an example:
class ISE
{
      void display()
     {
     System.out.println("IS is a good branch");
      }
    
}
 class EC extends ISE
{
     void display()
     {
           super.display();
           System.out.println("EC is also a good                 branch");
      }  
}
public class InheritanceAndPolymorphism
{
          public static void main(String args[])
         {
           EC r=new EC();
           r.display();
        }       
}
The output will be:
IS is a good branch
EC is also a good branch

Posted on by