- class members (properties , methods , constructors)
- classes defined in a package
Visibility simply means access.It can be set to different levels
by using these keywords
When applied to class members
public :
They are accessible everywhere
private :
Can be accessed only by the code in defining class
protected :
- Within the package : accessible everywhere
- Outside the package , only subclasses can access
default : When nothing is specified
Accessible only within the package
When applied to class
public :
Visible inside as well as outside the package in which it is defined
default : When nothing is specified
Visible only inside the package in which it is defined