- A state is an abstraction of the attribute values and links of an object.
- The response of an object to an event may include an action or a change of state by the object.
- A state corresponds to the interval between two events revived by an object. Events represent points in time; states represent intervals of time.
- A State JAVA has the duration; it occupies an interval of time.
- A state is often associated with the value of an object satisfying some condition.
- In the simplest case, each enumerated value of an attribute defines a separate state.
UML notation for a state:
- A rounded box containing a state name.
- In defining State JAVA we ignore attributes that do not affect the behavior of the object.
- The convention is to list the state name in Bold Face, Centered and First Letter of the State Name should be CAPITALIZED
- The UML notation for a state – a rounded box containing a state name.
Comparing Event and State
- Though Event and States having certain symmetry between them there exists some difference.
- The event represents points in time, while states represent intervals of time.
- The State having the suggestive name and natural language description of its purpose.
- Write the characteristics of a state Alarm Ringing.
- The below figure shows the state Alarm Ringing on a watch.