java没有enum吧,如果想用枚举类型的话,可以使用包含常量的接口
例如
public interface them{
  int red = 1;
  int yellow = 2;
  int blue = 3;}然后哪个类想用这些常量,就实现这个接口好了你写的enum them {red,yellow,blue};是C++里面的语法

解决方案 »

  1.   

    用类来代替ENUM结构,
    具体请看EFFECTIVE JAVA 第21条
    简单的例子:
    public class Color {
        private final String name;
        private Color(String name) {this.name = name;}
        public String toString() {return name;}
        
        public static final Color RED    = new Color("red");
        public static final Color YELLOW = new Color("yellow");
        public static final Color BLUE   = new Color("blue");
    }
      

  2.   

    public class them{
      public static final int red=1;
      public static final int blue=3;
      public static final int yellow = 2;
    }