JAVA Access Modifiers is used to set access levels for classes, variables, methods and constructors.
Access Control Modifiers
There are four Access Modifiers as below.
- default - Accessiable to the package. No modifiers are needed.
- private - Accessiable to the class only
- public - Accessiable to the all class and its all subclasses within in same package.
- protected - Accessiable to the package and all subclasses
Non-Access Modifiers
There are below Non-Access Modifiers are avalilable.
- static - It is used for class methods and variables
- final - It is used for finalizing implementations of classes, methods, and variables
- abstract - It is used for creating abstract classes and methods.
- synchronized - It is used for threads.
Comments