O'Reilly logo

Java, A Beginner’s Guide, 5th Edition by Herbert Schildt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Enumerations

Although the enumeration is a common programming feature that is found in many other computer languages, it was not part of the original specification for Java. One reason for this is that the enumeration is technically a convenience, rather than a necessity. However, over the years, many programmers had wanted Java to support enumerations because they offer an elegant, structured solution to a variety of programming tasks. This request was granted by the release of JDK 5, which added enumerations to Java.

In its simplest form, an enumeration is a list of named constants that define a new data type. An object of an enumeration type can hold only the values that are defined by the list. Thus, an enumeration gives you a way to precisely ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required