Java NumberFormatException

在编写项目代码时出现的一切不可控因素都要进行处理。

昨天写的

1 Integer count = Integer.parseInt(countStr);
2 
3 //如果不处理,很有可能出现Exception
4 
5 try{
6         Integer count = Integer.parseInt(countStr);
7 }catch(NumberFormatException e){
8         return false;
9 }

最后:认真对待你写的每行代码,尽管他就是个测试

原文地址:https://www.cnblogs.com/-Doraemon/p/4701150.html