摘要: 一个枚举类,可以看成包括它的一些子类(枚举)的一个类,而且枚举类的构造方法只能是私有的,如下面代码以交灯为示例: 1 public class Test { 2 3 public static void main(String[] args) { 4 Trafficlight light = Trafficlight.RED; 5 6 System.out.println(light.time); 7 System.out.println(light.nextLigth()); 8 // ordinal... 阅读全文
posted @ 2013-05-05 22:59 丁丁木木 阅读(731) 评论(0) 推荐(0) 编辑