编程中经常碰到数据类型转换的问题,现把经常用到的转换总结如下:
int-->Integer Integer.toString (int arg); new Integer(int arg);
int/boolean/char/long/Object-->String String.valueOf ( int/boolean/char/long/Object arg);
String-->int Integer.parseInt(String arg);
int-->Integer Integer.toString (int arg); new Integer(int arg);
int/boolean/char/long/Object-->String String.valueOf ( int/boolean/char/long/Object arg);
String-->int Integer.parseInt(String arg);