快捷搜索:  as  2018  FtCWSyGV  С˵  test  xxx  Ψһ  w3viyKQx

澳门威利斯人网站44_临夏教育信息网进入



package TuTorail.DataType;

public class Enumeration_Test {

enum Fubin {

Monday, Tuesday, Wedn澳门威利斯人网站44esday, Thursday, Friday, Saturday, Sunday

}

public static void main(String[] args) {

Fubin aFubin=Fubin.Friday;

System.out.println(aFubin);

//打印所有的内容及位置

for(Fubin b澳门威利斯人网站44Fubin:Fubin.values()){

System.out.println(bFubin+""+bFubin.ordinal());

}

//以下是Enumeration澳门威利斯人网站44的对照措施

Fubin day1, day2, day3;

day1 = Fubin.Monday;

day2 = Fubin.Tuesday;

day3 = Fubin.Friday;

if (day1.compareTo(day2)0)

System.out.println(day2 + " comes before " + day3);

if (day1.compareTo(day3) == 0)

System.out.println(day1 + " equal澳门威利斯人网站44s " + day3);

//转化成为数组

Fubin AllFubin[] = Fubin.values();

for(int i=0;iSystem.out.println(AllFubin[i]);

}

//取得某个值

Fubin Test1=Fubin.valueOf("Monday");

System.out.printl澳门威利斯人网站44n(Test1);

}

}

您可能还会对下面的文章感兴趣: