try catch可以这么用:校验!
2014-12-05 16:41
375 查看
try { int qtel = Integer.parseInt(certQtyTextField.getText()); if (qtel > 10 || qtel < 1) { MessageBox.warn("数量,请填写1-10之间的数字!"); return; } } catch (Exception e) { MessageBox.warn("数量,请填写1-10之间的数字!"); return; }
相关文章推荐
- 当你输入信用卡号码的时候,有没有担心输错了而造成损失呢?其实可以不必这么担心,因为并不是一个随便的信用卡号码都是合法的,它必须通过Luhn算法来验证通过。 该校验的过程:1、从卡号最后一位数字开始,逆
- 数组原来还可以这么玩
- JPA + SpringData 操作数据库原来可以这么简单 ---- 深入了解 JPA - 1
- 震惊!催眠居然可以这么简单!
- .Net中集合排序还可以这么玩
- case语句居然还可以这么用的
- WiFi 网络也可以这么玩
- 设计模式也可以这么简单
- 框架页面尽可以这么用(后置代码中控制框架)
- 微码汇结合房地产也可以这么玩
- 学不进去?可以试着这么做…… 普瑞马法则
- 发现自己在到数据的时候sql语句变得好熟悉了,也可以这么写的
- 类成员函数的回调原来可以这么写~
- 原来宏定义可以这么玩
- Android - sendOrderedBroadcast也可以这么用
- Java enum 枚举还可以这么用
- 如果想在UIView中直接进行跳转操作,你可以这么写
- 实体类的枚举属性--原来支持枚举类型这么简单,没有EF5.0也可以
- 从数据分析的角度看旅行青蛙还可以这么玩。。。
- 原来JS可以这么写