/
EnumExample.java
executable file
·56 lines (50 loc) · 1000 Bytes
/
EnumExample.java
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
45
46
47
48
49
50
51
52
53
54
55
56
import java.util.*;
import java.io.*;
import classfile.*;
// <enum>enum class example</enum>
// *j_enum_example* *jenum_example*
enum MyType {
NUM(3),
ROW(4);
int value;
MyType(int value) {
this.value=value;
}
int Value() {
return this.value;
}
}
enum DAY{
SUNDAY,
MONDAY,
TUESDAY,
WEDNESDAY,
THURSDAY,
FRIDAY,
SATURDAY
}
public class EnumExample {
public static void main(String[] args) {
test0();
test1();
}
static void test0(){
Aron.beg();
Print.pbl("NUM=" + MyType.NUM.Value());
Print.pbl("NUM=" + MyType.ROW.Value());
Aron.end();
}
static void test1(){
Aron.beg();
getDay(DAY.SUNDAY);
getDay(DAY.MONDAY);
Aron.end();
}
public static void getDay(DAY day){
if (day == DAY.SUNDAY){
Print.pbl("sunday");
}else if( day == DAY.MONDAY){
Print.pbl("monday");
}
}
}