Are all compile-time constants inlined?

后端 未结 6 1971
刺人心
刺人心 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:45

    No. You could replace them with a static method call, though, like:

    class ApplicationDefs {
    
        public static String configOption1() { return "some option"; }
    
    }
    

    Granted, it’s not beautiful but it would fulfill your requirement. :)

提交回复
热议问题