filmov
tv
Java Enum Basics: How to Get Started with Enumerations
Показать описание
In this example, the TrafficLight enum represents traffic light colors with their associated actions. It includes an abstract method getAction() and provides an implementation for each constant. The main method iterates through the enum constants and prints the actions for each traffic light color.