Design Patterns, Behavioural Design, Java, Software Development.
the next state context.setState(new GreenLightState()); } } class GreenLightState implements TrafficLightState { public void handleState(TrafficLight context) { System.out.println("Green Light: Go"); // Transition to the next state context.setState(new YellowLightState()); } } class