0
must call enumeration in a class?
I have a assignment and im stuck on this. Lets say im writing the class “public class Conditioner” which implements an interface and extends another class. In Conditioner , i have to write a constructor that takes in 1 parameter representing the name of the conditioner and the state of the conditioner should be Off. i dont know what to type to set it off. Off is one of the constants in enum that i also created. Tell me if you need more details
1 Odpowiedź
+ 5
Hm...
Given your Enum is named 'State', something like
State state = State.OFF;
If you need a method to call from outside
public void setState(State state) {
this.state = state;
}
Invocation:
setState(State.OFF);