首页 > 其他 > 详细

eum枚举

时间:2017-04-26 11:30:49      阅读:152      评论:0      收藏:0      [点我收藏+]

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());
    }
}

 

eum枚举

原文:http://www.cnblogs.com/javaweb2/p/6767543.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!