Java switch函数

switch()函数中能放置的值为:byte,short,char,int,string,enum类型或者byte,short,char,int的包装类,其中,string类型是java7(含)之后才支持的,其他类型数据会报错,

报错信息为:

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

posted @ 2018-12-02 16:03  魔瞳  阅读(1111)  评论(0编辑  收藏  举报