枚举用法
来源:互联网 发布:js时间戳有什么作用 编辑:程序博客网 时间:2024/06/11 15:45
枚举 :
public enum XxxType{
// 枚举数据
XXX_TYPE((short)1, "xxx"),
YYY_TYPE((short)2, "yyy");
// 两个私有属性
private short type; // 类型
private String message; // 描述
// 一个私有的构造函数
private XxxType(short type, String message) {
this.type=type;
this.message=message;
}
// 一个静态的获取方法
public static XxxType fromType(short type) {
foreach(XxxType xxxType: values()) {
if(xxxType.getType() == type) {
return xxxType;
}
}
return null;
}
// 两个获取属性的方法
public String getMessage(){
return this.message;
}
public short getType(){
return this.type;
}
}
0 0
- 枚举用法
- 枚举用法
- 枚举用法
- 枚举类型的用法
- 枚举简单用法
- 枚举的用法
- 枚举 Enum 的用法
- 枚举类型用法
- 枚举简单用法
- iOS中枚举用法
- 枚举用法总结
- enum(枚举)的用法
- java 枚举用法总结
- java 枚举用法详解
- 枚举的用法
- 枚举类的用法
- java 枚举用法详解
- 枚举用法详解
- go字符串复数
- Linux系统PWM驱动
- jquery $(this).attr $(this).val方法使用介绍
- 使用TextView实现消息提醒(徽章控件)
- java-框架-OkHttp
- 枚举用法
- 洪水_纪中1235_bfs
- wind下compser安装配置
- 常用网站
- ScrollView嵌套ListView冲突问题的最优解决方案
- Meeting Rooms II
- 安装storm1.0.1后worker启动不起来 nimbus.log中显示executor循环not alive
- Android杂谈(7)搞一搞Fragment+官方API底部导航制作
- JSON拼接字符串