【小王Java自习】

非数字抛出例外

java 复制代码
try {
            int tmp = Integer.parseInt(S);
            System.out.println(tmp);
        } catch (NumberFormatException ex){
            System.out.println("Bad Data");
        }

非法参数例外-自定义抛出信息

java 复制代码
throw new IllegalArgumentException("n and p should be non-negative");
相关推荐
Jooou1 天前
Spring事务实现原理深度解析:从源码到架构全面剖析
java·spring·架构·事务
fie88891 天前
基于MATLAB的狼群算法实现
开发语言·算法·matlab
gihigo19981 天前
MATLAB中生成混淆矩阵
开发语言·matlab·矩阵
曾几何时`1 天前
C++——this指针
开发语言·c++
盖世英雄酱581361 天前
commit 成功为什么数据只更新了部分?
java·数据库·后端
小冯的编程学习之路1 天前
【C++】: C++基于微服务的即时通讯系统(1)
开发语言·c++·微服务
码上淘金1 天前
在 YAML 中如何将 JSON 对象作为字符串整体赋值?——兼谈 Go Template 中的 fromJson 使用
java·golang·json
刘一说1 天前
Spring Boot 应用的指标收集与监控体系构建指南
java·spring boot·后端
穿西装的水獭1 天前
python将Excel数据写进图片中
开发语言·python·excel
老友@1 天前
Java Excel 导出:EasyExcel 使用详解
java·开发语言·excel·easyexcel·excel导出