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 "星期日";
}
};
public abstract String toLocaleString();
/**
* @param args
*/
public static void main(String[] args) {
enumTest a=enumTest.Mon;
String b=a.toLocaleString();
System.out.println(b);
}
}
这个就是枚举 我自己做的一道面试题 |