views:

716

answers:

5

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

+9  A: 

No. "access modifier" is the official term for private, protected and public, whereas the term "access specifier" does not occur at all in the Java language specification and is AFAIK not something that is widely used.

"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.

Michael Borgwardt
+1 for proving with the JLS. I think that it's after all just the language barrier.
BalusC
A: 

According to me, yes, both terms refer to the same thing and are used interchangeably.

missingfaktor
It's not up to you, it is up to the JLS, and the term 'access specifier' doesn't appear there at all.
EJP
A: 

Technically speaking private, public, protected and default are treated as access specifiers. These deal with who can ... questions. The modifiers afaik are volatile, final, static, transient etc. These deal with how does .. aspect.

questzen
Please provide a JLS citation for this assertion. It is baseless.
EJP
+2  A: 

Referring to the Sun Java Docs they both seem to be the same:

codaddict
A: 

That JDI reference is the only place I have ever seen the term 'access specifier' used in a Java specification. Even there, public/protected/private/package are also called 'modifiers'. There's really no reason to ever use the term 'access specifier' in Java, it is clearly just a mistake on one page out of many thousands.

EJP