float表示的范围比long大,不会超出范围,只是精度不够.我写了一个小程序:关于如何转换
public class testLong{
public static void main(String args[]){
Long a = 25L;
Float b ;
b = a.floatValue();
System.out.println(b);
}
}
在这里,给a赋值的时候必须加上后面的L,不然会把他当成int类型的变量给a,会报错的!作者: 胡元 时间: 2012-3-5 23:36
舞动的心弦 发表于 2012-3-5 23:05
float表示的范围比long大,不会超出范围,只是精度不够.我写了一个小程序:关于如何转换
public ...