In Java, all member variables of the interface (interface) are public static final by default, and only public static final.
All methods are public by default and can only be public.
Note: The methods in the interface are abstract methods, but do not need to write abstract.
That is, the following two segments of code are equivalent:
public interface T { public static final int I; public void M () {}} public interface
T {
int
I;
public
void
M () {}}
As to why the member variable is static final, it is to solve the problem of multiple inheritance in C + +, for example, multiple parent classes may have the same member variable, the subclass calls a lot of problems, so the interface simply declare the member variable is static, this variable will only in the data There is a copy in the segment, and the final variable is not allowed to be modified to prevent the problem from appearing.
Java Handy Sticker 6