数值和字符可以相互转化

其实字符也是数值类型
System.out.println((int)‘a’);
System.out.println((char)97);

输出结果:97
a
数值和符号之间可以相互转化,所以在switch…case…中除了能适用于数值,也能使用字符

猜你喜欢

转载自blog.csdn.net/m0_46651978/article/details/106741315