Static endpoints should be initialized in a static context, not in instances.
One parameter is to set the value in the declaration:
private static final Integer a=FileConfig.getInstance().getA();
Each class can have a static block {}, where code is called to initialize the static parts of the class.
static { a = FileConfig.getInstance().getA(); }
Finally, you can set the value from the static method
private static int getA() { return FileConfig.getInstance().getA(); } private static final Integer a=getA();
In closure, static instance initialization does not belong to instance constructors.
If the configuration values sometimes change, it just doesn't make sense to store the value of a in a static final variable. If you want to create each instance with constant a in the constructor, what is the purpose of the static field in the first place? Somehow, when you call the constructor for the first time, you are passing a value from somewhere . If a value deserves to be static and final, you can get it from a static initializer. If the configuration is not single, but each instance always produces the same value of a, you can easily do a = new FileConfig().getA(); .
In addition, you can make the value non-final, and be sure that, since you always put the same value a , the static variable will not change.
However, you can make a final class instance variable specified in the constructor.