RULE
Constants should be declared in a final class containing only constants.
Constants do not exist as such in an object oriented language like Java. Since we are often dealing with external systems and interfaces the need arises to have some kind of constant construct.
Constants should be defined public static final in a final class (not an interface) containing no other methods or fields.
public final class GenderConstants { public static final MALE = "male"; public static final FEMALE = "female"; }
A reference to one of these constants now looks like GenderConstants.MALE. We no know exactly where the constant comes from. JDK 5 note: do not use the import static keyword, if you do you lose the verbosity.