About interfaces, about io Interfaces
1. What is it?
Interface, which describes
Specifications, A type
DescriptionOr
Conventions. It cannot be understood as an abstract class. The meaning of an abstract class is how to direct and the interface tells you what to do,
Ii. Naming rulesGenerally
"I"Starting
"Able"End.
3. Syntax
1.The interface can only have methods. That is to say, the interface cannot have the variable (field) attribute. The interface is not implemented, and the field is meaningless.
2.You can define multiple methods or do not define any methods (* identifies an interface ).
3.The interface has no constructor, because the meaning of the interface is not what the interface can implement, and the constructor has no significance.
4.Access modifiers cannot be added to interface members.
5.Methods In the interface cannot be implemented.
6.The interface cannot be instantiated.
7.Abstract classes can only be single-inherited, and interfaces are multi-inherited.
Si. Purpose
1.For multi-Inheritance
2.When multiple classes have a common method, but they cannot abstract a parent class. You can use interfaces. (This is a bit difficult,
For example:
"The plane can fly, the birds can fly, and I can fly when I drink too much. Can these things abstract a parent class ?")