1. Classes that are more abstract than abstract classes are interfaces, interfaces (interface)
2. There are only two things in the interface: constants and exposed abstractions, void Tes () equivalent to public abstract void tes () public void Test ().
3. When the interface constant is defined, the constants that are written or not written are preceded by public static final, which is: int max_speed = 120; equivalent to public static final int max_speed = 120;
4. The meaning of the interface also lies in the separation of design and implementation, and interfaces abstract the common denominator of many classes.
5. Why do I need an interface? What is the difference between an interface and an abstract class? The
* interface is an abstract class that is more abstract than the abstract class, and can be constrained by a more canonical subclass. A comprehensive and professional realization: the separation of specifications and concrete implementation. The
* Interface is a specification, defined by a set of rules that embody the real world "if you are ... You must be able to ... "thought. For example: If you are an angel, you must be able to fly, if you are bad, you must bully good people. The nature of the
* interface is a contract, just like the law of our people. After the establishment of the people abide by.
* The specific requirements of the project are changeable, we must status quo to develop, the "unchanged" here is the "specification". So our development projects are interface-oriented programming.
6. Define interface:
Format:
[access modifier] Interface interface Name [extends parent interface 1, parent interface 2]{
& nbsp Constant definition //always public static final
method definition //always public Abstra CT
}
7. Subclasses implement specifications in interfaces by implements
8. Interfaces cannot create instances, but can be used to reference variable types.
9. A class implements an interface and must implement all the methods in the interface, and these methods can only be public.
10. The interface supports multiple inheritance.
11. Describing a more abstract relationship can only use interfaces. Because if you use inheritance only single inheritance cannot achieve a more abstract relationship.
java--Interface Supplement--implementation of the interface