- There is a lot of documentation on using preliminary solutions.
- There are many developers who use Java for the first time and have experience working in another language, where using constants is the norm.
- Many libraries wanted to support Java 1.4 and earlier. Java 1.3 and 1.4 are still in use today.
- The working code has not been rewritten to use enumerations.
I find that I'm still telling people to use enum for singleton, although it has been around for 7 years .: P
When will use constants be used instead of enum? When you have a lot of related but not directly related constants.
public static final int BUFFER_SIZE = 32 * 1024; public static final String ERROR = "Error: "; public static final char TAB = 't';
source share