Computer Applications
Answer
The various visibility modifiers in a class are as follows:
- public — The public members are accessible in all the classes whether a subclass or any other class in same package or another package.
- private — The private members are accessible only inside their own class and nowhere else.
- protected — The protected members are accessible inside all the classes in their own package as well as in all subclasses of their class.
- default — The default members are accessible inside all the classes of the same package.