-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMain01.java
More file actions
27 lines (22 loc) · 766 Bytes
/
Copy pathMain01.java
File metadata and controls
27 lines (22 loc) · 766 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
public class Main01{
public static void main(String[] args){
for (Weekday day:Weekday.values()){
System.out.println(day.name());
}
Weekday fri = Weekday.FRI;
System.out.println("FRI.name() = " + fri.name());
System.out.println("FRI.ordinal() = " + fri.ordinal());
System.out.println(Weekday.valueOf("FRI").name());
System.err.println(fri.toChinese());
}
}
enum Weekday{
SUN("星期日"), MON("星期一"), TUE("星期二"), WED("星期三"), THU("星期四"), FRI("星期五"), SAT("星期六");
private String chinese;
private Weekday(String chinese){
this.chinese = chinese;
}
public String toChinese(){
return chinese;
}
}