floatValuepublic float floatValue()
Returns the value of this Integer as a float.Overrides:floatValue in class Number
Returns:the int value represented by this object is converted to type float and the result of the conversion is returned.

解决方案 »

  1.   

    Integer temp = new Integer(100);
    Float temp1 = temp.floatValue();
      

  2.   

    int -> float 不需要强制转换。
    Integer -> Float :
        Integer temp = new Integer(100);
        Float temp1 = new Float(temp.floatValue()); 
    rinehart的答案中有一个小小的疏忽,float是基本类型,不能赋给Float对象。
      

  3.   

    不要什么转换吧,直接把Int 值传给 Float 类型就可以了,自动转换的呀
      

  4.   

    这不要什么转换呀,直接将INT 值给FLOAT 类型的就行了
      

  5.   

    sorry,是有疏漏,以forest()为准!
      

  6.   

    同上 直接将INT 值给FLOAT 类型的就行了 
      

  7.   

    那为何进行如下操作时报错:
    temp1=temp1*0.1/60;
    或temp1=temp1.0.1f/60f;
      

  8.   

    做运算的时候应该是基本数据类型的float,而不是Float对象!
    你先作完运算后,在转换成Float对象!
    float temp = 100f;
    Float temp1 = new Float(temp*0.1f/60f); 
      

  9.   

    double temp = 124.34;
    temp = Math.rint(temp*10)/10;