转自:
Java Integer如何转换double,float,int,long,string呢?
下文讲述Integer对象转换为double,float,int,long,string的方法分享
java中可以非常方便的将Integer类转换double,float,int,long,string,我们可以采用以下方法:
double doubleValue() //以 double 类型返回该 Integer 的值。
float floatValue() //以 float 类型返回该 Integer 的值。
int intValue() //以 int 类型返回该 Integer 的值。
long longValue() //以 long 类型返回该 Integer 的值。
String toString() //返回一个表示该Integer值的String对象。
例
public class IntegerValueDemo { public static void main(String[] args) { Integer a= new Integer(88); int intvalue=a.intValue(); double doublevalue=a.doubleValue(); long longvalue=a.longValue(); float floatvalue=a.floatValue(); string stringvalue=a.toString(); } }