How is this possible, because Java Docs also says that all the fields in the interface: public, staticand final.
From the Java Language Specification. Chapter 9. Interfaces. 9.3. Field (permanent) declarations (emphasis added):
Each field declaration in the body of the interface is implicit public , staticand final. It is allowed to over-specify any or all of these modifiers for such fields.
() , , , , ConstantModifier. >
, public. public, static final , . .
, :
interface Foo {
String bar = "Hello World";
}
interface Foo {
public String bar = "Hello World";
}
interface Foo {
static bar = "Hello World";
}
-.
, , . , . :
interface Foo {
private String bar = "Hello World";
}
bar public, .