The implementation of the method is not allowed in the interface, and the abstract class is allowed to implement the method and define the variable, so we can see that the interface is a higher level of abstraction than the abstract class. If an interface can define a variable, but the method in the interface is abstract, the property cannot be modified in the interface through the behavior (for example, the set () method). Then some people will suggest that you can modify the properties of an interface by implementing an instance of the class that implements the interface. Well, if there is a variable C in the interface, we change the value of C by implementing its Class A object, then Class B of the interface, C variables in Class C will be changed, imagine this will cause confusion, many want to implement the interface of the class do not know the interface is now what the C variable value, because the interface is changing, It is no longer a high-level abstraction, but a mutable ingredient. The so-called abstraction is to put some immutable things together, and mutable things are often placed in the implementation.
So we think about the meaning of the interface, in fact, it is a class of things properties and behavior of high-level abstraction, it embodies the OCP (to modify the closure, open to expansion) principle, which is our software development has been pursued.
Thinking of constants in Java interface