The enum constants can have their own states and behaviors. You can define a state and behavior that is common to all enum constants, or states and behaviors that are specific to each one of them. But can you access the state or behavior that is specific to an enum constant? Let's find out.
The state and behavior of enum constants
Adding states and behaviors to enum constants
You can add states and behaviors to enum constants by defining instance variables and methods in an enum. All of these are accessible by the enum constants. Let's modify the Size enum defined in the previous section, by adding a state and behavior to it. Each enum constant can define a constant, specific class body, define a new state and behavior...