作业帮 > 综合 > 作业

有关java.lang.NumberFormatException:null的问题

来源:学生作业帮 编辑:百度作业网作业帮 分类:综合作业 时间:2024/08/17 20:08:42
有关java.lang.NumberFormatException:null的问题
Whether the price you give is right

Ran)
//if(Integer.parseInt(price)>Integer.parseInt(Ran))
{
out.println("
a litle larger
");
out.println("");
flag=1;
session.setAttribute("flag","flag");
}
if(Price

运行上面代码会出现java.lang.NumberFormatException:null,
有关java.lang.NumberFormatException:null的问题
问题应该就出在那你那个:Integer.parseInt(变量)上,
从报错来说,应该是括号里面的“变量”是null,当然也就无法转换为Integer类型了.
建议你检查一下这几行代码:
1、flag = Integer.parseInt(flag1); //flag1为null,就会报你说的错误
2、int Price= Integer.parseInt(price); //price为null,就会报你说的错误
反正有Integer.parseInt()的地方都看一看,parseInt()方法括号里面的不能是null,也不能是其他无法转换为数字的字符串