Super keyword, final keyword

Source: Internet
Author: User
The Super keyword    subclass can hide member variables and methods inherited from a parent class, and you can use the Super keyword if the subclass wants to use the member variables and methods that are hidden by the quilt class.     1. Calling the constructor of the parent class using the Super keyword the       subclass cannot inherit the constructor of the parent class, so if the subclass wants to use the constructor of the parent class, it must be used in the constructor method of the subclass and must be represented by the keyword super. It must also be used in the first sentence of the subclass's construction method.         2, using the Super keyword operation is hidden member variables and methods         such as  super.x        super.play () is used to access the call Quilt class hidden member variable X and method play ()      final keyword     The final keyword can be used to decorate classes, member variables, and local variables in methods      1, the final class final class can          not be inherited, that is, there can be no child class.     2           . The final method can be inherited by the quilt class, but cannot be overridden.    3. Final variable             

  

Super keyword, final keyword

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.