Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes Access modifiers and access control Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Access modifiers and access control" Watch "Access modifiers and access control" New topic
Author

Access modifiers and access control

Rohan Deshmkh
Ranch Hand

Joined: Aug 31, 2012
Posts: 127
As per the book "Sun Certified Programmer for Java 6" By Kathy Sierra and Bert Bates , Chapter 1 , page12

There are 4 access control namely: public , private, protected and default . But there are only 3 access modifiers namely: public,private and protected.
So my question is why is it so?What's the difference between access control and access modifiers?

After going through this forum i also assume that there is no such thing as access specifier in java(if you search for specifier in jls, there is nothing about specifier in jls document).
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7545
    
  18

Rohan Deshmkh wrote:So my question is why is it so?What's the difference between access control and access modifiers?

'access control' is what it does; 'access modifier' is how you write it. The "default" access (sometimes called 'package private') is what you get when you don't specify a modifier.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 924
    
    1

some books call access modifiers as access specifier also. there is no naming convention regarding them in jls. use access specifier or access modifier that does not make difference . both are synonyms. access control is as Winston said what THESE modifiers do. they provide access control.
Rohan Deshmkh
Ranch Hand

Joined: Aug 31, 2012
Posts: 127
Ok thanks, i got it.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Access modifiers and access control
 
Similar Threads
Access Specifiers vs Access Modifiers
Access Controls and access modifiers
remembering access modifiers
Diff. between Access Specifiers and Access Modifiers?
Please solve the problem...