Java中不能将float和doublu类数据作为switch(...)中的表达式!
其它语言有待验证-_-!...
验证代码如下:
public class test{
public static void main(String[] args) {
float b =1.0f;
//double c=2.0;
switch(b){
case 1.0f: break;
//case 2.0;
default: ;
}
}
}
出错提示如下:
注意:Java中Switch语句的参数类型-_-!...
阅读 21
2023-01-25
Java中不能将float和doublu类数据作为switch(...)中的表达式!
其它语言有待验证-_-!...
验证代码如下:
public class test{
public static void main(String[] args) {
float b =1.0f;
//double c=2.0;
switch(b){
case 1.0f: break;
//case 2.0;
default: ;
}
}
}
出错提示如下:
相关推荐
精彩评论(0)