November 11, 2009 at 3:56 PM
Access Modifiers : Access modifiers are used to specify the visibility and accessibility of a class, member variables and methods. Java provides some access modifiers like: public, private etc.. These can also be used with the member variables and methods to specify their accessibility.
public keyword specifies that the public class, the public fields and the public methods can be accessed from anywhere.
private: This keyword provides the accessibility only within a class i.e. private fields and methods can be accessed only within the same class.
protected: This modifier makes a member of the class available to all classes in the same package and all sub classes of the class.
default : Its not a keyword. When we don't write any access modifier then default is considered. It allows the class, fields and methods accessible within the package only.