Here we must use a variable to represent any of the three status values: ON, OFF, or UNKNOWN. We also know that a variable cannot take values other than these three values. Thus, we can say that these three values represent a range of values to which a state variable can be bound. When we think of other types of data, such as int, char, et., They also have a predefined range of values. Therefore, in this case, we need to create a custom data type with these three values as a range. Enumerations are used in such scenarios and can be defined as Jeff Foster:
public enum ActiveState { ON, OFF, UNKNOWN }
source share