枚举类的使用例子
来源:互联网 发布:部落冲突建筑升级数据 编辑:程序博客网 时间:2024/05/16 08:45
枚举类的使用,有构造函数,有函数哟
package com.bird.test;import org.junit.Test;public class EumeTest {@Testpublic void print() {String day;day = Week.MON.getValue();System.out.println(day + Week.MON.getValue1());}}enum Week {MON("星期一") {public String getValue1() {return "this is the first day.";}},TUE("星期二") {public String getValue1() {return "this is the first day.";}},WED("星期三") {public String getValue1() {return "this is the first day.";}},THU("星期四"){public String getValue1() {return "this is the first day.";}},FRI("星期五"){public String getValue1() {return "this is the first day.";}},SAT("星期六"){public String getValue1() {return "this is the first day.";}},SUN("星期日"){public String getValue1() {return "this is the first day.";}};private String value;private Week(String value) {this.value = value;}public String getValue() {return value;}public abstract String getValue1();}
运行结果:
星期一this is the first day.
- 枚举类的使用例子
- 枚举类的用法例子
- 枚举的各种形式的使用例子
- java枚举的使用小例子
- 枚举使用小例子
- enum枚举类的一个简单例子
- java 枚举类的简单例子
- 枚举的例子
- 一个枚举的例子
- 枚举类的使用
- 枚举类的使用
- 枚举类的使用
- mfc 枚举enum使用例子
- 枚举类例子
- 一个枚举目录的例子
- 枚举值转换的例子
- 一个枚举的简单例子
- 枚举类Enumeration的使用
- 第七周任务1
- ACM-欧拉函数
- acm-polya计数公式
- 关于安装蛋疼的ruby gem : tk-win
- ACM-大数N!的位数公式
- 枚举类的使用例子
- ACM-大数阶乘末尾零的个数
- unity3D简单的汽车游戏
- 生活-女生的正确生活方式
- 12个球和一个天平,现知道只有一个和其它的重量不同,问怎样称才能用三次就找到那个球,13个呢
- poj 1671 Rhyme Schemes
- 生活-仙剑3的另类台词
- 你妹啊,程序员你伤不起的一些谬论 - 生活在回忆里
- HDU 1060 Leftmost Digit(求n^n的最左位)