开发者

Does the order of keywords in variable definition matter?

Is there any difference between the or开发者_JAVA百科der:

public static final String = "something";

or

public final static String = "something";

?


No, although the Java Language Specification recommends that you use the first ordering:

FieldModifiers:
  FieldModifier
  FieldModifiers FieldModifier

FieldModifier: one of
  Annotation public protected private
  static final transient volatile

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


No - there is no difference betweeen the two.

From section 8.3.1 of the Java 2 Language Specification:

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


No. Pick one and follow that naming convention consistently

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜