January 2018
Intermediate to advanced
115 pages
1h 37m
English
An enumeration, or enum, is a type that consists of a fixed list of named constants. To create one, the enum keyword is used followed by a name and a code block containing a comma-separated list of constant elements. The access level for an enum is the same as for a class. Package-private by default, but it can also be set to public if it’s declared in a file of the same name. As with classes, an enum can be contained within a class, where it can then be set to any access level:
An object of the enum type just shown can hold any one of the four ...