How to override Java Methods

Overriding java methods happen in a case where a child class implements a method that is contained in super class.The main use of overriding is to provide a new implementation of a method.

Overriding Java methods can take place if only:-

  • Child class and parent class are in IS-A inheritance.
  • Child class method should have the same name as parent class.
  • Child class method should have the same parameters as the parent class.

Overriding Java methods Example

 

See also: Overloading Java Methods

About the Author: Eric K

Kenyan Developer and Blogger with Interests in Java,Javascript,Node.js, Wordpress, Android, PHP and Making Money Online. Solving world problems through programming is my passion. Hire me: Email : kawi3462@gmail.com