性别Sex、YesOrNo 采用枚举的方式实现

Sex

/**
 * 性别枚举
 */
public enum Sex {
    woman(0,"女"),
    man(1,"男"),
    secret(2,"保密");

    public final int type;
    public final String value;

    Sex(int type, String value) {
        this.type = type;
        this.value = value;
    }
}

YesOrNo

/**
 * YesOrNo枚举
 */
public enum YesOrNo {
    NO(0,"否"),
    Yes(1,"是");


    public final int type;
    public final String value;

    YesOrNo(int type, String value) {
        this.type = type;
        this.value = value;
    }
}
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页