zz switch的参数类型
时间:2011-05-07 来源:little rookie
from:http://esyscn.com/thread-73353-1-1.html
关于switch的参数类型
switch ( expr1 )中, expr1 是一个整数表达式,整数表达式可以是int基本类型或Integer包装类型,由于, byte,short,char都可以隐含转换为 int ,所以,这些类型以及这些类型的包装类型也是可以的。因此传递给 switch 和 case 语句的参数应该是 int 、 short 、 char 或者 byte。 long,string 都不能作用于 swtich 。
相关阅读 更多 +
排行榜 更多 +