class wrenwren
{
public static void main(String args[])
{
String aa = "09";
String bb = "0x3a";
int c; c = Integer.decode(aa);
System.out.println(c); c = Integer.decode(bb);
System.out.println(c);
}
}为什么有异常呢??
{
public static void main(String args[])
{
String aa = "09";
String bb = "0x3a";
int c; c = Integer.decode(aa);
System.out.println(c); c = Integer.decode(bb);
System.out.println(c);
}
}为什么有异常呢??
String aa = "011";
改为
String aa = "9";
------------------------------------------------
还有楼主你可以这样改:c = Integer.valueOf(aa);
------------------------------------------------
这样恐怕不是楼主所想要的结果吧.
你这样可能有NumberFormatException异常.
如果这样可以的话,那parseInt(aa);
等.
等不也可以都用上了.
为什么mm总是null呢???
# (cps4351000)
#
# 等 级:
getInteger方法不是把字符串转换为integer值;是用来确定具有指定名称的系统属性的整数值的方法,对应的字符串为属性名,不是随便的字符串。