This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
What are accessor modifiers? Can you explain them with example. Does static, final are accessor modifiers.
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.