Crazy Java handouts--inheritance

Source: Internet
Author: User
Tags instance method throw exception

This article is just a record of my Learning the crazy Java handout, the previous Java knowledge to check the gaps in the summary.

Method overrides

Method overrides to follow the "two same two small one big" rule. "Two identical" means the method name is the same, the formal parameter list is the same, "two small" refers to the subclass method return value type should be more than the parent class method return value type is smaller or equal, subclass method declaration Throw exception class should be more than the parent class method declaration throw exception class smaller or equal; A large "refers to the subclass method that access permissions should be greater or equal than the parent class method access. In particular, the overriding method and the overridden method are either class methods or instance methods, not one class method and one instance method; for example:

Super Limit

Inherit attention Point

Crazy Java handouts--inheritance

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.