I have a class with all the configuration from a property file.
My first solution is this:
public class Config {
public static final int disc;
static {
// Read property file and set properties
disc = 5;
}
}
Reading the information in this way:
System.out.println(Config.disc);
The second solution is:
public class Config {
private int disc;
public void Config() {
// Read property file and set properties
disc = 5;
}
public int getDisc() {
return this.disc;
}
}
Reading in that way:
System.out.println(new Config().getDisc());
What's the best way and why? What the advantages and disadvantages?