- public class test
 
 - {
 
 -         public static void main(String[] args) {
 
 -                 
 
 -                 print(WeekDay.SUN);
 
  
-         }
 
 -         public static void print(WeekDay w)
 
 -         {
 
 -                 String value = w.getValue();
 
 -                 System.out.println(value);
 
 -         }
 
 -         
 
 - }
 
 -  enum WeekDay{
 
 -         SUN("星期天"),MON("星期一"),TUE("星期二"),WED("星期三"),THT("星期四"),FRI("星期五"),SAT("星期六");
 
 -          private WeekDay() {};
 
 -         private String value;
 
 -         private void WeekDay(String value){
 
 -                 this.value = value;
 
 -         }
 
 -         public String getValue()
 
 -         {
 
 -                 return this.value;
 
 -         }
 
 -         // private WeekDay(int day) {};
 
 - }
 
  复制代码 |