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 |
Public: Any package, any class accessibility is available
Private: Access is not available outside the class
Protected: When an attribute of a method is declared as protected then it is visible to all the classes in the same package and all subclasses in different package