Home > Back-end >  How to use the enumeration
How to use the enumeration

Time:10-21

I use an enumeration defines the enable and disable 1 0, now I am going to enable to disable enumeration set method how can I modify

CodePudding user response:

Enum STATE {
ON,
OFF
}
Public static void main (String [] args) {
The STATE STATE=STATE. OFF;
State=state. ON;
}

CodePudding user response:

reference 1/f, restart response:
enum STATE {
ON,
OFF
}
Public static void main (String [] args) {
The STATE STATE=STATE. OFF;
State=state. ON;
}

How am I in the dao layer changed on to off

CodePudding user response:

refer to the second floor qq_46108173 response:
Quote: refer to 1st floor restart response:
enum STATE {
ON,
OFF
}
Public static void main (String [] args) {
The STATE STATE=STATE. OFF;
State=state. ON;
}

Me how I can put on the dao layer instead off

We have to do is direct assignment

CodePudding user response:

Enumeration can only use the get method, isn't it can't use the set

CodePudding user response:

Constant value assignment

CodePudding user response:

Enumeration belongs to immutable classes, the constructor is private, do not provide the SETTER, if you want to change the value of the enumeration should be with the wrong data structure

CodePudding user response:

I want to change on to off
  • Related