Chapter 6 Knowledge Points

 1. The properties in the interface are global static constants, the methods in the interface are global abstract methods, and there is no constructor in the interface.
2. A class can only inherit one parent class, but it can implement multiple interfaces. If a class implements an interface, it must implement all the methods in the interface, otherwise it must be defined as an abstract class. Java achieves the effect of multiple inheritance by implementing interfaces.
3. An interface represents a contract, an interface represents a capability, and an interface embodies the principle of separation of contract and implementation.
4. Abstract classes are conducive to code reuse, and interfaces are conducive to code maintenance.
5. Through interface-oriented programming, the coupling between codes can be reduced, and the scalability and maintainability of the code can be improved.
6. Interface-oriented programming means: when developing the system, the main framework uses the interface, and the interface constitutes the skeleton of the system, so that the system can be replaced by replacing the class that implements the interface.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325956971&siteId=291194637