Java has four access modifier namely private , protected and public . package level access is default access level provided by Java if no access modifier is specified. These access modifiers are used to restrict accessibility of a class, method or variable on which it applies. We will start from private access modifier which is most restrictive access modifier and then go towards public which is least restrictive access modifier, along the way we will see some best practices while using access modifier in Java and some examples of using private and protected keywords. private keyword in Java private keyword or modifier in java can be applied to member field, method or nested class in Java. you can not use the private modifier on top level class. private variables, methods, and class are only accessible on the class on which they are declar...