public class WeekDeom {
//枚举U1,U2,U3 public enum Week { U1,U2,U3 } public void dowhat(Week day) { switch (day) { case U1: System.out.println("第一单元打基础"); break; case U2: System.out.println("第二单元可以胜任java软件开发"); break; case U3: System.out.println("第三单元可以胜任企业级java程序开发"); break; default: System.out.println("不及格回去重读!"); break; } } public static void main(String[] args) { WeekDeom wd = new WeekDeom(); wd.dowhat(Week.U1); wd.dowhat(Week.U2); wd.dowhat(Week.U3); //第二种输出格式 //Week u1=Week.U1 //wd.dowhat(u1); //Week u2=Week.U2; //wd.dowhat(u2); //Week u3=Week.U3; //wd.dowhat(u3); } }
原文:http://www.cnblogs.com/ichimoku/p/7663549.html