eum枚举

1.枚举案例

package com.eum;

public enum Type {

    //列出枚举
    insert(1),update(2),select(3),delete(4);
    
//    设置属性值
    private Integer value;

    private Type(Integer value) {
        this.value = value;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }
    
    public static void main(String[] args) {
        //获取枚举列表
        Type [] t=Type.values();
        for (Type type : t) {
            System.out.println(type);
        }
        //获取具体值
        System.out.println(Type.delete.getValue());
    }
}
原文地址:https://www.cnblogs.com/javaweb2/p/6767543.html