switch语句相关

Cannot switch on a value of type long. Only convertible int values, strings or enum variables are permitted

switch无法作用于long类型的值。 只允许可转换的int值,字符串或枚举变量

String i = "2";
switch (i){
   case "1":
       System.out.println(1);
   case "2":
       System.out.println(2);
}    

 

posted @ 2017-08-24 20:05  如果屈原会编程  阅读(261)  评论(0编辑  收藏  举报