*
The moose likes Beginning Java and the fly likes Accessor Modifiers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Accessor Modifiers" Watch "Accessor Modifiers" New topic
Author

Accessor Modifiers

Arathi Raj
Ranch Hand

Joined: Nov 22, 2002
Posts: 90
Hi,

What are accessor modifiers? Can you explain them with example.
Does static, final are accessor modifiers.

Thanks
Arathi
Sathya Srinivasan
Ranch Hand

Joined: Jan 29, 2002
Posts: 379
Access modifiers are the embellishments made on a variable, method, or class to define how visible they are to the outside world.

The valid modifiers are public, private, protected, and no modifier at all (sometimes referred to as default).

Here are the definitions:

public: Visible to all
protected: Visible to classes (or methods in other classes) in the same package or those that are sub-classes of the class.
private: Visible only to methods in the same class.
(default): Visible only to methods to classes in the same package.

Most of the Java beginner books explain this pretty much in-depth with examples.


Cheers, Sathya Srinivasan - SCJP 1.2, SCWCD 1.2, SCMAD 1.0
Co-Author of Whizlabs SCMAD Certification Exam Simulator and SCMAD Exam Guide Book
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Moving to Java in General(beginner)


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Sherry Jacob
Ranch Hand

Joined: Jun 29, 2005
Posts: 128
Originally posted by Arathi Raj:
Hi,

What are accessor modifiers? Can you explain them with example.
Does static, final are accessor modifiers.

Thanks
Arathi



I think Srinivasan has done most of the explaining for you.

As far as static and final are concerned, yes, they are access modifiers.
A static member is a class-wide member whereas a final member is one that cannot be modified again. In other words, final means constant.


<strong><br />Cheers !!<br /> <br />Sherry<br /></strong><br />[SCJP 1.4]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
[Sherry]: As far as static and final are concerned, yes, they are access modifiers.

They are modifiers, but they are not access modifiers. Access modifier refers to public, protected, and private. (And no modifier, for "package", I suppose).


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessor Modifiers
 
Similar Threads
Protected and Private
visible modifiers
access modifiers for Members in an interface
?(inheritance) from a newbie
Default constructor