switch(整数表达式/枚举常量)

来源:互联网 发布:贺卫方 知乎 编辑:程序博客网 时间:2024/05/17 08:43
switch(表达式),
因为byte、short、char都可以转换成整型(int),而String、long不可以,表达式的内容为整数表达式或枚举常量,整数表达式即为int或integer型,
所以switch能作用在byte上而不能作用在long和String上
0 0
原创粉丝点击