Qus:    What are the various access specifiers in Java?
Feb 09, 2021 11:12 1 Answers Views: 435 VAMSI
Prev Next
Answers (1)
SANJAY Feb 10, 2021 08:02
Answer:   In Java, access specifiers are the keywords which are used to define the access scope of the method, class, or a variable. In Java, there are four access specifiers given below.
o Public The classes, methods, or variables which are defined as public, can be accessed by any class or method.
o Protected Protected can be accessed by the class of the same package, or by the sub-class of this class, or within the same class.
o Default Default are accessible within the package only. By default, all the classes, methods, and variables are of default scope.
o Private The private class, methods, or variables defined as private can be accessed within the class only.

Post Your Answer
Guest User

Not sure what course is right for you?

Choose the right course for you.
Get the help of our experts and find a course that best suits your needs.


Let`s Connect