Non-Access Modifiers


There are two kinds of modifiers: Non-Access Modifiers for Classes
For classes, you can use either final or abstract:

Modifier Description
final The class cannot be inherited by other classes.
abstract The class cannot be used to create objects. (To access an abstract class, it must be inherited from another class.)


Non-Access Modifiers for Attributes and Methods
For attributes and methods, you can use one of the following modifiers:

Modifier Description
final Attributes and methods cannot be overridden/modified.
static Attributes and methods belong to the class, rather than an object.
abstract Can only be used in an abstract class, and can only be used on methods. The method does not have a body, for example, abstract void run( );. The body is provided by the subclass (inherited from).
transient Attributes and methods are skipped when serializing the object containing them.
synchronized Methods can only be accessed by one thread at a time.
volatile The value of an attribute is not cached thread-locally, and is always read from the “main memory.”




      “Music is ... A higher revelation than all Wisdom & Philosophy”    
      ― Ludwig van Beethoven