在 Java 中,我发现一些开发人员这样写:
public static functionName() {}
但其他一些人写道:
static public functionName() {}
这两者有什么区别?
最佳答案
来自Java Language Specification, section 8.4.3 :
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.
因此它们可以以任何顺序出现,但有一个推荐 订购。顺序是:
Annotation public protected private abstract static final synchronized native strictfp
关于java - 'public static' 和 'static public' 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17258697/