The number of inheritance between classes and classes, classes and interfaces, and interfaces

Source: Internet
Author: User
1. Classes and classes can be represented as inheritance relationships, expressed by the extends keyword. This is because if a class inherits Class A and Class B, if AB has two similar methods, it cannot determine which method to inherit, therefore, class inheritance can only be one-to-one. However, a class can have multiple subclasses,
A class can have only one parent class.
2. The relationship between classes and interfaces can be expressed as an implementation relationship, expressed by the implements keyword. A class can implement multiple interfaces. Because methods in interfaces are abstract methods,
Only the form has no specific implementation, which is implemented in the class.
3. An interface and an interface can be represented as an inherited relationship. An interface is represented by the extends keyword. An interface can inherit multiple interfaces.

The number of inheritance between classes and classes, classes and interfaces, and interfaces

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.