Lesson 17
This is a simple one. Java will let you define an enumerated type- or limit all the possible values a variable can have. For example:
enum Entrees {chicken, beef, fish, pork, tofu}
Entrees dinnerMenu;
dinnerMenu = Entrees.beef;
The variable dinnerMenu is now restricted to the 5 options given by the type Entrees. It is considered type-safe, which means attempted use of a value that doesn’t exist will result in a compile-time error. The value is accessed using dot notation.