Interface
Initial understanding Interface interface is a special abstract class with only public abstract methods and global constants in the interface.
1. Define the interface with interface.
2. The format of the members in the interface
public static final int a=1;
public abstract void Show ();
These are the two forms of membership in an interface.
3. If the interface is defined without the static final abstract keyword, the keyword is added to the interface by default.
Attention:
1. Members and methods can only be decorated with public permissions in an interface
2. An interface cannot create an object because it has an abstract method that requires a quilt class implementation, so you have to define all the abstract methods in the subclass to interface so that the class can create objects. If an abstract method is not implemented by the quilt class, the subclass is still an abstract class.
3. Relationship
Relationship between classes and classes: inheriting extends
The relationship between interfaces and classes: implementing implements
The relationship between interfaces and interfaces: inheritance;
4.
There can be a class that implements multiple interfaces between a class and an interface. A class cannot inherit more than one class.