On Mon, Nov 22, 2010 at 2:50 PM, Guillaume Nodet <[email protected]> wrote: > AFAIK, the best pattern for that is to use a final with a private > constructor and declare public static final fields in it. > > public class Constants { > private Constants() { > // non-instantiable class > } > > public static final String TYPE = "type"; > }
Sounds good. One additional improvement would be to declare the class as final, just to avoid that other classes inherit from it. Kind Regards, Stefan
