switch能否作用在byte、long、String上?

2025-04-23 19:16:18
推荐回答(1个)
回答1:

switch(表达式),表达式的内容为整数表达式或枚举常量,整数表达式即为int或integer型,因为byte、short、char都可以转换成整型,而String、long不可以,所以switch能作用在byte上而不能作用在long和String上