public class Test {
    public enum Dogs {collie, harrier};
    public static void main(String [] args) {
        Dogs myDog = Dogs.collie;
        switch (myDog) {//怎么看可以呢?
            case collie:
              System.out.print("collie  ");
            case harrier:
              System.out.print("harrier  ");
        }
  
   }
}
结束输出collie  harrier

解决方案 »

  1.   

    Since you are using enum, then you should know it's features. It can be used in switch structure, together with anything that can be implicitly casted to int.
      

  2.   

    后面加个.values()看看,具体的可参考下面的例子public class EnumDemo{
      public enum Seasons { 
       winter,spring,summer,fall;
     }
     public static void main(String[] args){
      for(Seasons s:Seasons.values()){
       System.out.println(s);
     }
    }