default (package private – access in other classes within the same package)
public (visible everywhere)
protected (only access in its own class, its subclass and other classes within the same package)
private (only access in its own class)
http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html
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 |