Modifiers in Java

Modifiers in Java

Modifier are keyword that are added to those definition to change their meaning.
Java has a two types of modifier,

I.Access Control Modifier. II. Non-Access Modifier.

Access Control Modifier
Java provide access modifier to control access levels for classes, variable and constructor. Default – It visible to the same package. No modifiers are need. Public – It visible to the world. Protected – It visible within the package and all sub classes. Private – It visible within the classes only.

Non-Access Modifier

Java can provide some other modifier to provide rather than visibility . This modifier are called Non-Access Modifier. Each modifier have their own functionality .The most used non-access modifier listed below.

Final – Modifier to finalizing the implementations of classes, methods, and variables. Static – Modifier to create class methods and variables . Abstract – Modifier for creating abstract classes and methods . Transient– Modifier is included in the statement that creates the variable, preceding the
class or data type of the variable. Synchronized and Volatile -Modifiers for use in threads.