Share on Google+Share on Google+

Overriding in java

Advertisement
Click on following link to know all about Overriding in Java

Some key points about overriding in java

  1. The overriding method must have same arguments, it means return type of argument should be same with number of argument.
  2. The overriding method must have less restrictive access modifier.
  3. The return type of overriding method must be the same.
  4. If you want your method not to be overridden mark it with final at the beginning.
  5. With context of constructor it can be overloaded but cannot be overridden.
  6. The concrete class overrides the abstract method.
  7. The private method is not overridden.
  8. A default method may be overridden by a default, protected or public method.
  9. A public overridden method then the overriding method must also be in public. But in the case of protected it can be overridden by protected and public also.
  10. A protected method may not be overridden by a default or private method.

More about Overriding

Advertisements

Advertisement

Posted on: July 1, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.