The Java® Language Specification, Java SE 7 Edition, Fourth Edition
by James Gosling, Bill Joy, Guy Steele, Gilad Bracha, Alex Buckley
7.6. Top Level Type Declarations
A top level type declaration declares a top level class type (§8) or a top level interface type (§9).
TypeDeclaration: ClassDeclaration InterfaceDeclaration ;
By default, the top level types declared in a package are accessible only within the compilation units of that package, but a type may be declared to be public to grant access to the type from code in other packages (§6.6, §8.1.1, §9.1.1).
It is a compile-time error if a top level type declaration contains any one of the following access modifiers: protected, private, or static.
It is a compile-time error if the name of a top level type appears as the name of any other top level class or interface type declared in the same package.
It is a compile-time ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access