I am an almost-graduating computer science student, and throughout my coding career, I\'ve found very few instances where enumerations, except for canonical cases such as re
What you would define as String
/ int
constants before Java 1.5, you should now define as enums. For example, instead of having:
public class StatusConstants {
public int ACTIVE = 1;
public int SUSPENDED = 2;
public int TEMPORARY_INACTIVE = 3;
public int NOT_CONFIRMED = 4;
}
You now have a safer and more developer-friendly:
public enum Status {
ACTIVE, SUSPENDED, TEMPORARY_INACTIVE, NOT_CONFIRMED
}
Same goes for anything that has more than one options, like statuses, street types (str., boul., rd., etc), user access levels (administrator, moderator, regular user), etc. etc.
Check this for more examples and explanations.