public class test
{
// 类执行部分
public static void main(String[] args)
{ Integer i= Integer.valueOf("599");
System.out.println(i); }
}
{
// 类执行部分
public static void main(String[] args)
{ Integer i= Integer.valueOf("599");
System.out.println(i); }
}
应该:int i= (Integer.valueOf("599")).intValue();
alueOf 返回的是 一个 Integer 对象。
如果转换成int ,请用 parseInt如下,一切就没问题了。。public class test
{
// 类执行部分
public static void main(String[] args)
{
int i;
i = Integer.parseInt("599");
System.out.println(i);
Integer ii;
ii = Integer.valueOf("599");
System.out.println(ii); }
}
import java.util.*;
public class test
{
// 类执行部分
public static void main(String[] args)
{ int i= 599;
String str = i.toString(); // 这里转换不成字符串
System.out.println(str); }
}
String str = (new Integer(i)).toString();
或:
String str = i + "";
String str = Integer.toString(i); // 这里转换不成字符串
System.out.println(str);===================================
我的一分耕耘,你能给一分收获
boolean -> Boolean
char -> Unicode
Unicode -> Character
byte -> Byte
short -> Short
int -> Integer
long -> Long
float -> Float
double -> Double
void -> Void还有只有从Object继承下来的类才有toString()的方法
基础类型没有!
祝你好运!