用法一:常量 在JDK1.5 之前,我们定义常量都是: public static fianl.... .现在好了,有了枚举,可以把相关的常量分组到一个枚举类型里,而且枚举提供了比常量更多的方法. public enum Color { RED, GREEN, BLANK, YELLOW } 用法二:switch JDK1.6之前的switch语句只支持int,char,enum类型,使用枚举,能让我们的代码可读性更强. enum Signal { GREEN, YELLOW, RED } pu
1. 枚举类定义 在某些情况下,一个类的对象是有限而且固定的,比如季节类,它只有4个对象,这种实例有限而且固定的类,在Java里被称为枚举类. 2. 早期实现枚举的方式 public static final int SEASON_SPRING = 1; public static final int SEASON_SUMMER= 2; public static final int SEASON_FALL = 3; public static final int SEASON_WINTER =
Mysql类为网络上收集的,没有测试过.. using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data; using MySql.Data; using MySql.Data.MySqlClient; using System.Data.Com
枚举类 枚举类不出来的时候只能如下写代码 //Student.java package cn.itcast.enumeration; public class Student { private String name; private String grade;//A B C D E public String getName() { return name; } public void setName(String name) { this.name = name; } public Str