JAVA learning ----- interface, java ----- Interface

Source: Internet
Author: User

JAVA learning ----- interface, java ----- Interface

Make a simple summary of the interface through one day's study.

Interface, the interface mentioned here is actually a standard, can also be understood as a standard, basic requirements. First, an interface is a special abstract class that only contains basic attribute parameters, abstract methods, internal classes, and enumeration classes. It does not contain specific implementation processes. It requires other classes that want to use this interface, and provides detailed descriptions of the methods in the interface according to their actual conditions.

In the interface, all defined attribute parameters are of the public static final type by default, methods are of the public abstract type by default, and internal classes and enumeration classes are of the public static type by default.

At the same time, the interface has the following basic requirements:

1. The class implements the interface through implements, and the class is of the abstract type.

2. The property value defined in the interface cannot be modified.

3. interfaces can inherit interfaces.

4. A class can inherit one class and implement multiple interfaces at the same time, but extends must be in front.

5. A new interface object is not allowed, but a variable of the interface reference type can be defined and pointed to the object implementing the interface to achieve polymorphism.


The above is a brief introduction to the interface, and the interface-oriented programming will be summarized later.

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.