September 2011
Beginner
650 pages
15h 47m
English
Although the preceding examples show the mechanics of creating and using an enumeration, they don’t show all of its capabilities. Unlike the way enumerations are implemented in some other languages, Java implements enumerations as class types. Although you don’t instantiate an enum using new, it otherwise acts much like other classes. The fact that enum defines a class enables the Java enumeration to have powers that enumerations in some other languages do not. For example, you can give it constructors, add instance variables and methods, and even implement interfaces.
Read now
Unlock full access