29
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Java のメソッド修飾子(method modifiers) の順番は決まっている

Last updated at Posted at 2016-12-23

Java の method modifiers の順番

Java のメソッド修飾子(method modifiers) の順番は一応決まっています。

Annotation public protected private
abstract static final synchronized native strictfp

の順で書くのが習慣上よいそうです。

public static final
× public final static

public abstract
× abstract public

言語仕様に書いてある

なんとJavaの言語仕様にかいてありました。
言語仕様のなかでコーディングスタイルにまで言及するんですね。意外でした。

If two or more (distinct) method modifiers appear in a method declaration, it is customary, though not required, that they appear in the order consistent with that shown above in the production for MethodModifier.

The Java® Language Specification - Java SE 12 Edition
https://docs.oracle.com/javase/specs/jls/se12/html/jls-8.html#jls-8.4.3

参考

29
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
29
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?