package myfirstpackage;
public class MyTest {
public static void main(String[] args) {
Test t = Test.test1;
}
}
class Test
{
private Test(String s)
{
System.out.println(s);
}
public static final Test
test1 = new Test("test1"),
test2 = new Test("test2"),
test3 = new Test("test3");
}
这是我写的简单的枚举,以下是打印结果
test1
test2
test3 |