Java中的Enum的继承

public    interface Icolor{
        
       int apply(int x,int y);
    }
    
 public enum color implements Icolor{
     
     plus("+"){
         
        public int apply(int x,int y){ return x+y;}
     },
     min("-"){
         
        public int apply(int x,int y){ return x-y;}
     }
     
     ;
     
     
          private final String num;
          color(String num){
              this.num=num;
          }
    
     }

//调用 color.plus.apply(100, 1)

 

posted @ 2017-06-22 10:59  甜菜波波  阅读(9796)  评论(0编辑  收藏  举报