Java - Modifier

> Procedural Languages > Java

Table of Contents

1 - About

A modifiers affect runtime behaviour of class or method

  • Access modifiers: public, protected, and private
  • Modifier requiring override: abstract
  • Modifier restricting to one instance: static
  • Modifier prohibiting value modification: final
  • Modifier forcing strict floating point behaviour: strictfp

Not all modifiers are allowed on all classes, for example an interface cannot be final and an enum cannot be abstract.

java.lang.reflect.Modifier contains declarations for all possible modifiers.

Advertising