Java · Medium
Explain the State pattern. How does it differ from Strategy? Provide a real-world Java example.
JavaAdvanced JavaDesign Patterns
Answer preview
The State pattern allows an object to alter its behavior when its internal state changes. The object will appear to change its class.…