public enum TypeEnum {
/**
* 类型1
*/
T1(1, "类型1"),
T2(2, "类型2"),
T3(3, "类型3");
private final Integer value;
private final String name;
TypeEnum(Integer value, String name) {
this.value = value;
this.name = name;
}
public String getName() {
return this.name;
}
public Integer getValue() {
return this.value;
}
}
public class Demo {
public static void main(String[] args) {
System.out.println( TypeEnum.T2.getValue());
// 2
System.out.println( TypeEnum.T2.getName());
// 类型2
}
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。