Recommended order of a method's mutiple modifiers

 

The method modifiers consist of the following:

 

annotations

 

access modifiers 

 

abstract 

 

static 

 

final: A final method cannot be overridden in a subclass.

 

synchronized: A synchronized method has additional semantics related to the control of concurrent threads within a program.

 

native 

 

strict: floating point A method declared strictfp has all floating-point arithmetic evaluated strictly. If a method is declared within a class declared strictfp, then that method is implicitly declared strictfp. 

 

An abstract method cannot be static, final, synchronized, native, or strict. A native method cannot be strict.

 

When multiple modifiers are applied to the same method declaration, we recommend using the order listed.

 

Reference: 《The Java Language Programming, the Fourth Edition》

 

你可能感兴趣的:(java,Class)