Switch选择语句能否作用在String【字符串】上,也就是能否这么写:Switch(一个字符串变量)?

 

解答:不可以,只能处理int,byte,short,char,(其实是只能处理int,其它三种是可以promotion到int型)不能处理Sring 。

相关文章:

  • 2022-12-23
  • 2022-01-08
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2021-07-31
猜你喜欢
  • 2021-10-13
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案