In Java's interface, the default modifier for member variables is: public static final
So when we define member variables in the interface, we can
1:public static final String name = "Zhang San";
2:string name = "Zhang San";
Both of the above can be, the old driver is generally the second kind. Since it is a static final variable, it means that you cannot modify the value of this member variable while accessing it outside. Therefore, defining member variables in an interface is generally constant. is not modified. If modifications are to be made, they are defined in the interface-specific implementation class.
Finish the default modifier for the member variable, and by the way, the default modifier for the method, the default modifier for the method is: public abstract
That is, the public abstraction, is used to implement the interface of the class to implement the method. So there are two ways of defining a method in an interface.
1:public abstract list<string> getusernames (Long CompanyID);
2:list<string> getusernames (Long CompanyID);
The same old drivers are the second kind.
Interface is only a higher abstraction of the properties and behaviors of a class of things, and it is an embodiment of the open and closed principle in Java to close the modification.
Java interface member variables and method default modifiers