+1 vote
in JAVA by
What are the various access specifiers for Java classes?

1 Answer

0 votes
by

In Java, access specifiers are the keywords used before a class name which defines the access scope. The types of access specifiers for classes are:

1. Public : Class,Method,Field is accessible from anywhere.

2. Protected:Method,Field can be accessed from the same class to which they belong or from the sub-classes,and from the class of same package,but not from outside.

3. Default: Method,Field,class can be accessed only from the same package and not from outside of it’s native package.

4. Private: Method,Field can be accessed from the same class to which they belong.

Related questions

+1 vote
asked Jun 17, 2019 in JAVA by reins.robin
0 votes
asked May 2, 2021 in JAVA by sharadyadav1986
...