创建枚举类,枚举一般用在可穷举的场景,枚举的描述,除了最后一个是分号,其他的都是逗号
使用枚举类
如果不使用枚举那就用常量实现,但是枚举更好一点
例
private final static int Spring=1;
private final static int Summer=2;
private final static int Autumn=3;
private final static int winter=4;
创建枚举类,枚举一般用在可穷举的场景,枚举的描述,除了最后一个是分号,其他的都是逗号
使用枚举类
如果不使用枚举那就用常量实现,但是枚举更好一点
例
private final static int Spring=1;
private final static int Summer=2;
private final static int Autumn=3;
private final static int winter=4;
相关文章: