Java枚举的小用法

 

package com.lxc.wmb;

public enum TestEnum {
    Success("200","成功!"),
    Faild("500","错误!");
    
    private String code;
    private String msg;
    
    private TestEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    
    public String getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    
}

 

posted @ 2018-03-26 15:10  如果屈原会编程  阅读(105)  评论(0编辑  收藏  举报