-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnum.java
More file actions
44 lines (36 loc) · 915 Bytes
/
Copy pathEnum.java
File metadata and controls
44 lines (36 loc) · 915 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
42
43
44
package src.thinkinginjava.Initialization5;
/**
* Created by Ryan on 2017/1/19.
*/
public class Enum {
public enum Test{
TEST1,TEST2,TEST3,TEST4
}
public static void print(Test test){
switch (test) {
case TEST1:
System.out.print("TEST1");
break;
case TEST2:
System.out.print("TEST2");
break;
case TEST3:
System.out.print("TEST3");
break;
case TEST4:
System.out.print("TEST4");
break;
default:
System.out.print("out");
}
}
public static void order(){
for(Test t: Test.values()){
System.out.println(t + " , " + t.ordinal());
}
}
public static void main(String[] args){
//print(Test.TEST1);
order();
}
}