In the nature of Object Oriented Programming, attributes and methods can be assigned different access levels, exposing themselves to other classes.

This helps to mitigate accidental error of modifying an internal value.


Access Levels

public access

Everything has access

protected access

Any subclass within any package has access

default access (no modifier)

Any subclass only within the same package has access

private access

No access