Interface
An interface is a special kind of abstract class. All methods in an interface are abstract, and all methods do not provide a concrete implementation, because the interface is all abstract and cannot be instantiated, only the method can be implemented. A class cannot inherit an interface, only a method that implements an interface definition. If a class implements an interface, it must define all methods, unless he is an abstract class
An interface can be understood as a capability, and whoever implements it will gain this ability to define variables in the interface, but must bepublic static final 数据类型 名字
Interfaces are not classes, and interfaces contain only the behavior that a class needs to implement
The use of interfaces
Interfaces can be used to expose certain behaviors of a class, not all behaviors. Interfaces can also be used to enforce behavior on other objects to ensure that some methods are implemented by the object
Interface declarationpublic interface 接口名{任意数量的final static成员变量和任意数量的方法}
Interface Implementation public class 类名 extends 父类名 implements 接口名 A class can implement multiple interfaces, and the interface uses commas "," to separate
Inheritance and Interfaces
Inheritance is an abstraction of an object----interface is an abstraction of the behavior
Debugging
function Key -F5: One-step debugging, if a method is called to jump into the method-F6: Step debugging, but does not jump into the method-F7: Jump out of the method currently being debugged-F8: not single-step debugging, jump directly to the next hit a breakpoint position
Java Learning (ix)