Monday, March 28, 2011

Java access control

There are two levels of access control:

* At the top level—public, or package-private (no explicit modifier).
* At the member level—public, private, protected, or package-private (no explicit modifier).

Access Levels
Modifier Class Package Subclass World
public Y Y Y Y
protected Y Y Y N
no modifier Y Y N N
private Y N N N

No comments:

Post a Comment