Switch Statement gives Incompatible Types error

前端 未结 5 1058
长发绾君心
长发绾君心 2020-12-11 03:25

I am trying to compile and I get this error:

enigma/Rotor.java:30: incompatible types found : java.lang.String required: int     switch(name){
1 error
         


        
5条回答
  •  醉话见心
    2020-12-11 03:53

    switch accepts a String from java 7. prior to java 7 only int compatible types (short,byte,int, char) can be passed as switch arguments

提交回复
热议问题