Modifiers in Java

Modifiers Matrix

This table (matrix) shows which modifier to which element can be applied.

See a matrix of the Protection Modifiers in Java - how they set the visibility and the access rights.

Modifiers-Elements Matrix in Java
element Data field Method Constructor Class Interface
modifier top level
(outer)
nested
(inner)
top level
(outer)
nested
(inner)
abstract no yes no yes yes yes yes
final yes yes no yes yes no no
native no yes no no no no no
private yes yes yes no yes no yes
protected yes yes yes no yes no yes
public yes yes yes yes yes yes yes
static yes yes no no yes no yes
synchronized no yes no no no no no
transient yes no no no no no no
volatile yes no no no no no no
strictfp no yes no yes yes yes yes

Rules

Further reading


Retrieved from http://bmanolov.free.fr/javamodifiers.php.