must call enumeration in a class? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

3rd Apr 2019, 4:28 PM
Jamie Charles
1 Answer
+ 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);
3rd Apr 2019, 5:45 PM
Tashi N
Tashi N - avatar