Object-Oriented Programming

Source: Internet
Author: User

Inheritance:
The java Language stipulates that the constructor of any subclass must call the constructor of its parent class, and the statement that calls the constructor of the parent class must be the first statement in the subclass constructor, the format is:
Super (call parameter list );
Super is the keyword, indicating the parent class. "Super (call parameter list)" calls the corresponding constructor of the parent class. If the program does not explicitly write a statement that calls the constructor of the parent class, during compilation and execution, java automatically and implicitly adds statements that call the parent class constructor without any parameters before the first statement of the subclass constructor. Therefore, the system will call the constructor of its parent class before calling the subclass.
Polymorphism:
Static polymorphism: static polymorphism can be identified by the system during compilation. It refers to the functional overloading of methods with the same name in the same class. In the form of method declaration, reload requires the same method name and different parameter lists.
Dynamic polymorphism: Dynamic polymorphism cannot be identified by the system at compilation and can only be identified by the system at runtime. Dynamic polymorphism refers to the overwriting of Methods declared for the same parent class by subclass methods. That is, subclass and parent Classes define methods with the same declaration, but they generally have different meanings and functions.
Author: "Technical lab"

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.