Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between access specifiers and access modifiers?

In Java, are access specifiers and access modifiers the same thing?

like image 425
Saurabh Gokhale Avatar asked Feb 10 '10 17:02

Saurabh Gokhale


People also ask

What is difference between access specifier and access modifier in C++?

There are no differences between the specifiers and modifiers, and the use of both is the same. The access modifier is an official term and the new term that we use instead of modifier is specifier.

What are different types of access modifiers access specifiers )?

Java provides four types of access modifiers or visibility specifiers i.e. default, public, private, and protected.

What are access specifiers?

In C++, there are three access specifiers: public - members are accessible from outside the class. private - members cannot be accessed (or viewed) from outside the class. protected - members cannot be accessed from outside the class, however, they can be accessed in inherited classes.


1 Answers

"access modifier" is the official term for private, protected and public used in the Java language specification. "access specifier" is used synonymously in the Java API doc, but this is the first time I've noticed that. It's probably better to stick with the JLS term.

like image 62
Michael Borgwardt Avatar answered Sep 19 '22 13:09

Michael Borgwardt