本文讲解两方面的内容
1.枚举的使用
2.多线程中单例模式的实现
1.枚举的使用
参看http://developer.51cto.com/art/201107/275031.htm
http://www.cnblogs.com/zhaoyanjun/p/5659811.html
自定义枚举类如下
public class MyObject {
public enum Color {
RED("红色", 1), GREEN("绿色", 2), BLANK("白色", 3), YELLO("黄色", 4);//枚举变量
//枚举变量的属性,和枚举变量对应
private String name ;
private int index ;
//枚举类的构造方法,私有是为了防止被实例化
private Color( String name , int index ){
this.name = name ;
this.index = index ;
}
//set,get方法
public String getName() {
return