枚举

 

 1 public enum WeekEnum {

 2 

 3     MON("星期一")

 4     ,THE("星期二")

 5     ,WED("星期三")

 6     ,THU("生期四")

 7     ,FIR("星期五")

 8     ,SAT("星期六")

 9     ,SUN("星期日");

10     

11     private String value;

12     

13     private WeekEnum(String value){

14         this.value = value;

15     }

16     

17     public String getValue(){

18         return this.value;

19     }

20 }
public class WeekEnumTest {



    @Test

    public void Test(){

        String res = printTest(WeekEnum.MON);

        System.out.println(res);

    }

    

    public String printTest(WeekEnum weekCount){

        return weekCount.getValue();

    }

}

 

你可能感兴趣的:(枚举)