Methods and data members of a class/interface in java can have one of the following four access specifiers.
1) private (class specific)
2) default (when no access specifier is specified, package specific)
3) protected (used in inheritence)
4) public (visible to all packages classes and subclasses)
The classes and interfaces themselves can have only two access specifiers when declared outside any other class.
1) public
2) default (when no access specifier is specified)
We cannot declare class/interface with private or protected access specifiers. For example, following program fails in compilation.