jdk1.7之前,switch支持的类型有:byte、short、char、int、或者其对应的包装类和枚举(Enum)类型
jdk1.7加入了String类型,但是不支持long类型,long类型转成int可能丢失精度,byte、short、char转成int
不会丢失精度。
转自:http://blog.csdn.net/beixiaozhang/article/details/52956229
jdk1.7之前,switch支持的类型有:byte、short、char、int、或者其对应的包装类和枚举(Enum)类型
jdk1.7加入了String类型,但是不支持long类型,long类型转成int可能丢失精度,byte、short、char转成int
不会丢失精度。
转自:http://blog.csdn.net/beixiaozhang/article/details/52956229