-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnumOrder.java
More file actions
41 lines (38 loc) · 775 Bytes
/
EnumOrder.java
File metadata and controls
41 lines (38 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package initialValues;
enum Spiciness {
NOT,
MILD,
MEDIUM,
HOT,
FLAMEING
}
public class EnumOrder {
public static void main(String[] args) {
for(Spiciness s : Spiciness.values()) {
System.out.println(s + " " + s.ordinal());
}
describe(Spiciness.HOT);
describe(Spiciness.MILD);
}
static void describe(Spiciness degree) {
switch(degree) {
case NOT:
System.out.println("NOT");
break;
case MILD:
System.out.println("MILD");
break;
case MEDIUM:
System.out.println("MEDIUM");
break;
case HOT:
System.out.println("HOT");
break;
case FLAMEING:
System.out.println("FLAMEING");
break;
default:
break;
}
}
}