A
Ahmed Moustafa
Where should application-wide contants be defined e.g. in a class or an
interface?
Thanks in advance!
interface?
Thanks in advance!
Where should application-wide contants be defined e.g. in a class or an
interface?
Thanks in advance!
Joe said:They should be public static final members of an abstract class.
Where should application-wide contants be defined e.g. in a class or an
interface?
Roedy said:Java 1.5 has a new answer to that old question.
Where should application-wide contants be defined e.g. in a class or an
interface?
enum?
Roedy said:no, a way of exposing constants so they don't need the class name
qualification.
Ahmed said:Where should application-wide contants be defined e.g. in a class or an
interface?
Thanks in advance!
Roedy said:no. You have all the fuss of creating the singleton and the extra
overhead of finding the singleton. The constants are no longer static
finals, so you can't use them in case statements.
Just make them static finals in either an interface or class.
My constants include matrices that I load from a text files, I hold
these matrices in a class that extends HashMap and the keys are the
names of the files.
The class is going to be Singleton because I need only one instance per JVM.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.