Modifier Types

Modifiers are catchphrases that you add to definitions to change their implications. The Java programming language has a wide and mixed bag of modifiers, including the accompanying:

  • Non-Access Modifiers
  • Java Access Modifiers

In order to utilize a modifier, you incorporate its catchphrase in the meaning of a class, variable or method. The modifier goes before whatever is left of the announcement.

Access Control Modifiers:

Java gives various access modifiers to set access levels for classes, variables, routines and constructors. The four right to gain access are:

  • Private: visible to the class.
  • Default: visible to the bundle. No modifiers are required.
  • Secured: visible to all subclasses and package.
  • Public: visible to the world.

Non Access Modifiers:

Java gives various non-access modifiers to attain numerous other usefulness.

  • Static:
    The static modifier for making class variables and methods.
  • Final
    The final modifier for concluding the executions of classes, variables and methods.
  • Abstract
    This modifier is used for for creating abstract methods and classes.
  • Volatile and Synchronized    These modifiers are typically used for threads.