我个人认为:
你只要能够把:
public class Season
{
SPRING;//还原为private static final Season SPRING=new Season(实例化的具体值);
这样还不明白?
private static final 有了这个修饰不就跟符合单列只能够创建一个对象的规则?(符合饿汉式)
你new Season();那肯定就要有对应的构造函数了。
}作者: 何羡玉 时间: 2013-5-13 13:20
package enhanceTest;
public abstract class enumTest {
private enumTest(){}
public static final enumTest Mon= new enumTest()
{ public String toLocaleString()
{
return "星期一";
}
};
public static final enumTest Tes= new enumTest()
{ public String toLocaleString()
{
return "星期二";
}
};
public static final enumTest Wed= new enumTest()
{ public String toLocaleString()
{
return "星期三";
}
};
public static final enumTest Thur= new enumTest()
{ public String toLocaleString()
{
return "星期四";
}
};
public static final enumTest Fri= new enumTest()
{ public String toLocaleString()
{
return "星期五";
}
};
public static final enumTest Satu= new enumTest()
{ public String toLocaleString()
{
return "星期六";
}
};
public static final enumTest Sun= new enumTest()
{ public String toLocaleString()
{
return "星期日";
}
};