Which access specifiers can be used with keyword class?
Answers
There are four access specifiers for classes in java : Private: Methods, Variables and Constructors that are declared private can only be accessed within the declared class itself. Public: A , method, constructor, interface etc declared public can be accessed from any other class.
Explanation:
Access specifiers or sometimes JAVA visibility specifiers are keywords in JAVA that set the accessibility of classes, methods, and other members. They are a specific and important part of programming language syntax which is used to facilitate the encapsulation of components. They determine whether a field or method in a class, can be used or invoked by another method in another class or sub-class.
There are four types of access specifiers in JAVA.They are:-
1. public
2. private
3. protected
4. default (or no specifier)