Suppose you need to define a class which all it does is hold constants.
public static final String SOME_CONST = "SOME_VALUE";
What is the preferred way of doing this?
- Abstract Class
- Final Class
Which one should I use and why?
Clarifications to some answers:
Enums – I'm not going to use enums, I am not enumerating anything, just collecting some constants which are not related to each other in any way.
Interface – I'm not going to set any class as one that implements the interface. Just want to use the interface to call constants like so: