Access Restrictions of Methods/Fields
Clients have access to only public methods.
Derived classes have access to public & protected members
of the base class.
Classes within the same package have access to protected
and package members of the base class.
Public – can be used by anyone .
Package – by methods of the class and in same package.
Protected – by methods of the class and subclasses and in
the same package.
Private – only by members of the same class.