Hi...
Ques : Hello all of you now I have read access modifier please explain State the significance of public, private, protected, default modifiers both singly and in combination and state the effect of package relationships on declared items qualified by these modifiers.
State the significance of public, private, protected
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Satyapriya NayakRank #47 · 31.5K reputationPosted Jan 10, 2012, 7:05 AM EST
public : Public class is visible in other packages, field is visible everywhere (class must be public too)
private : Private variables or methods may be used only by an instance of the same class that declares the variable or method, A private feature may only be accessed by the class that owns the feature.
protected : Is available to all classes in the same package and also available to all subclasses of the class that owns the protected feature.This access is provided even to subclasses that reside in a different package from the class that owns the protected feature.
default :It means that it is visible to all within a particular package.
Thanks
karthik v115 reputationPosted Jan 10, 2012, 9:24 AM EST
Please refer to the following link : Link