The rules for applying
field modifiers are outlined in
JLS 8.3.1:
- A modifier cannot be specified more than once.
- Multiple access modifiers cannot be used simultaneously.
While the order of modifiers is technically
free, the conventional sequence generally followed is:
@Annotations, access (public/private/protected),
static final transient volatile
For
method modifiers, requirements are detailed in
JLS 8.4.3:
- The same requirements as for field modifiers.
- When used with
abstract, only protected or public can be used. - A
native method cannot use strictfp.
Similarly, while not required, the following order is recommended:
@Annotations, access (public/private/protected),
abstract static final synchronized native strictfp