最终静态和静态最终之间的差异 [英] Difference between final static and static final
问题描述
我找到了一个代码,它声明代码如
I found a code where it declared code like
private final static String API_RTN_SUCCESS = "0";
private final static String API_RTN_ERROR = "1";
public static final String SHARED_PREFERENCE_CONFIG = "shared_preference_config";
public static final String STARTUP_SETTING_KEY = "startup_setting";
它们之间有什么区别或相同?或者私人
或公开
?
What is the difference between them or are they same? Or does it differ for private
or public
?
推荐答案
完全没有区别。根据
8.3 .1 - 类 - Java语言规范的字段修饰符,
如果出现两个或多个(不同的)字段修饰符一个字段声明,按照惯例,虽然不是必需的,但它们的出现顺序与FieldModifier制作中的上述顺序一致。
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.
对于字段,所述生产按此顺序列出修饰符:
For fields, the said production lists the modifiers in this order:
@Annotation
public
protected
private
static
final
transient
volatile
对于方法:
@Annotation
public
protected
private
abstract
static
final
synchronized
native
strictfp
@Annotation
public
protected
private
abstract
static
final
synchronized
native
strictfp
这篇关于最终静态和静态最终之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!