Posted on 2011-08-01 16:20
xsong 阅读(211)
评论(0) 编辑 收藏 所属分类:
java
enum Action {Start, Stop, Rewind, Forward};
// Special type of class
enum Status {
Flunk(50), Pass(70), Excel(90);
private final int value;
Status(int value) { this.value = value; }
public int value() { return value; }
};
Action a = Action.Stop;
if (a != Action.Start)
System.out.println(a); // Prints "Stop"
Status s = Status.Pass;
System.out.println(s.value()); // Prints "70"