Design Pattern: State Pattern

In State pattern, an object (context object) changes its behavior when a certain internal state is changed. On state change the context object will change its behavior completely- like for performing a certain operation the context object will use different objects when the state is changed. This state change is managed internally so the client which is using the context object might not be aware of the state change.

Design Pattern: State Pattern in Java

State pattern is used to change the behavior of an object when the state is changed. With the change in state, the behavior of that object is completely changed. This article demonstrates State pattern implementations in Java.