In Chapter 2, “Language Fundamentals,” you learned that you sometimes use static final fields as enumerated values. Java 5 added a new type, enum, for enumerating values. This chapter presents a complete discussion of enum.
You use enum to create a set of valid values for a field or a method. For example, in a typical application, the only possible values for the customerType are Individual or Organization. For the State field, valid values may be all the states in the US plus Canadian provinces, and some others. With enum, you can easily restrict your program to take only one of the valid values.
An enum type can stand alone or can be part of a class. You make it stand alone if it needs to be referenced ...