Objects can change states in response to events or over time. A UML state diagram captures these state changes by showing the possible states of an object, the transitions between states, and the starting and ending points of state change sequences. It also models the entry and exit activities that occur when a system enters or leaves a state, as well as activities that occur within a state. Guard conditions can be used to specify when a transition takes place.