您的位置:首页 > 编程语言 > Java开发

java.lang.NumberFormatException: Invalid int: ""的解决方法

2016-08-17 13:21 716 查看
java.lang.NumberFormatException: Invalid int: ""不能成功转成int类型错误代码:
private int allCount;
String temp = null;
allCount = Integer.parseInt(temp);
更改代码(添加try catch使之兼容性增强):
try {
String temp = null;
allCount = Integer.parseInt(temp);
} catch (Exception e) {
allCount = 200;
}

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐