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()); } }
时间: 2024-10-12 19:11:48