Wednesday, April 18, 2007

What are Java Modifiers?

Java classes, interfaces, and their members can be declared with one or more modifiers.They can be categorised as:

Class Modifiers :
ClassModifier: one of
public private(for inner classes) protected(for inner classes)
abstract static final strictfp
Any top level class can either be public or package private(no explicit modifier)

Field Modifiers
FieldModifier: one of
public protected private
static final transient volatile

Method Modifiers
MethodModifier: one of
public protected private abstract static
final synchronized native strictfp

Constructor Modifiers
ConstructorModifier: one of
public protected private

The following matrix of the all modifiers in Java shows which modifier maps to which element:-

More on access specifiers..


Dhara Ganatra said...

Matrix shown is very useful. Great job done. Thanks buddy

Anonymous said...

The matrix is great, for a text description, check here: Java Modifiers


Interview Questions On Java,Java EE Copyright © 2017. Reads: best tracker