Java67 - Java Program Example Tutorial Blog

Java67 - Java Program Example Tutorial Blog


What is public private protected and package or default access modifier in Java

Posted: 29 Dec 2012 03:19 AM PST

public, private, protected and package or default are four access modifier available in Java. These access modifier provides Java programmer to control accessibility or visibility of class, method or any field of class. Good understanding of public, private or protected modifier is required in order to implement proper encapsulation in Java and create a Java program which is easier to maintain. In this Java tutorial we will see what is public, private, protected and default modifiers are, which modifier can be used with top level class and nested class and what are difference between public, private, protected and default modifier in Java. We In next section we will discuss all four access modifier in decreasing order of accessibility, starting from public which is most accessible and going down to private which is least accessible.
Read more »


Post a Comment