Are all compile-time constants inlined?

后端 未结 6 1975
刺人心
刺人心 2020-11-29 05:39

Let\'s say I have a class like this:

class ApplicationDefs{
public static final String configOption1 = \"some option\";
public static final String configOpti         


        
6条回答
  •  长情又很酷
    2020-11-29 05:56

    No, it's part of the JLS, I'm afraid. This is touched upon, briefly, in Java Puzzlers but I don't have my copy to hand.

    I guess you might consider having these constants defined in a properties file, and have the class that loads them periodically.

    Reference: http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#5313

提交回复
热议问题