注意:Java中Switch语句的参数类型-_-!...

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: ;
}
}
}

出错提示如下:



posted @ 2011-12-18 16:01  氺〤魚Oo。  阅读(201)  评论(0编辑  收藏  举报