对方法使用static public boolean
和public static boolean
有什么区别?
我刚刚尝试了两者,两者似乎都编译得很好并且具有相同的效果,除非我做错了。哪一个更好,为什么?
最佳答案
绝对没有区别,但就惯例而言,将 public
放在第一位稍微更受欢迎。来自 section 8.4.3 of the Java Language Specification :
MethodModifier
: one ofAnnotation public protected private abstract static final synchronized native strictfp
...
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.
关于java - 静态公共(public) boolean 值与公共(public)静态 boolean 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15721115/