5. 25. 8. Class Member Access Control Modifiers |
|
Class members (methods, fields, constructors, etc) can have one of four access control levels: |
- public,
- protected,
- private, and
- default access.
|
Access Level From classes in other packages From classes in the same package From child classes From the same class
public yes yes yes yes
protected no yes yes yes
default no yes no yes
private no no no yes
|
|
The default access is sometimes called package private. |
Access levels to constructors are the same as those for fields and methods. |