Access Modifiers – Public, Private, Protected & Default


Public This is the least restrictive,accessible to entire project;

Default If no access modifier is specified in the declaration, accessible only within package,not accessible in other packages or sub packages;

Protected Accessible to all classes in the package and to all sub-classes of its class in any package where this class is visible.

Private -This is the most restrictive accessibility modifiers. These members are accessible only with in the same class.



0 comments:

Post a Comment