Java Modifiers

Java Modifiers

Modifiers are keywords that you add to those definitions to change their meanings.

Access Modifiers: public, protected, private, default

Java provides a number of access modifiers to set access levels for classes, variables, methods and constructors.
The four access levels are:

  • Visible to package, the default. No modifiers are needed.
  • Visible to class only (private).
  • Visible to world (public).
  • Visible to the package and all subclasses (protected).
Non-access Modifiers: static, final, abstract, strictfp
Java provides a number of non-access modifiers to achieve many other functionality.
  • The static modifiers for creating class methods and variables.
  • The final modifiers for finalizing the implementations of classes, methods and variables.
  • The abstract modifier for creating abstract classes and methods.
  • The synchronized and volatile modifiers, which are used for threads.

Comments

Popular posts from this blog

Constant in Java

Java History, Features and Application types