Method Overriding: Superclass, Then The Method in The Subclass Is Said To Override The Method in The Superclass. When An
Method Overriding: Superclass, Then The Method in The Subclass Is Said To Override The Method in The Superclass. When An
In a class hierarchy, when a method in a subclass has the same name and type signature as a method in its
superclass, then the method in the subclass is said to override the method in the superclass. When an
overridden method is called from within a subclass, it will always refer to the version of that method defined
by the subclass. The version of the method defined by the superclass will be hidden.
In other words, If subclass provides the specific implementation of the method that has been provided by one
of its parent class, it is known as method overriding.
Usage of Java Method Overriding
Method overriding is used to provide specific implementation of a method that is already provided by its
super class.
Method overriding is used for runtime polymorphism