当前位置:网站首页>Custom exception
Custom exception
2022-07-02 15:32:00 【Killer is not too cold!】
Custom exception
While the program is running , Sometimes when you finish executing a piece of code, you find that the program code is illogical , So we want to return End this code , But the return value type of the method where this code is located is void, So we can't return, So what should we do at this time ? At this time, we can customize an exception , Then actively throw an exception in the method .
The custom exception code is as follows :
/** * @Author zy.xuan * @Date 2022/6/21 14:13 */
public class ComplaintExeception extends RuntimeException {
private String message;
public ComplaintExeception(String message){
this.message = message;
}
@Override
public String toString() {
return message;
}
}
Test custom exceptions , Here's the picture :
边栏推荐
- Solution of Queen n problem
- 02_ Linear table_ Sequence table
- Facing the challenge of "lack of core", how can Feiling provide a stable and strong guarantee for customers' production capacity?
- Pytorch 保存tensor到.mat文件
- TiDB数据迁移场景综述
- 哈夫曼树:(1)输入各字符及其权值(2)构造哈夫曼树(3)进行哈夫曼编码(4)查找HC[i],得到各字符的哈夫曼编码
- 03_线性表_链表
- Engineer evaluation | rk3568 development board hands-on test
- Let your HMI have more advantages. Fet-g2ld-c core board is a good choice
- Libcurl Lesson 13 static library introduces OpenSSL compilation dependency
猜你喜欢
. Solution to the problem of Chinese garbled code when net core reads files
4. Jctree related knowledge learning
你不知道的Set集合
LeetCode刷题——去除重复字母#316#Medium
03_线性表_链表
Evaluation of embedded rz/g2l processor core board and development board of Feiling
MySQL -- Index Optimization -- order by
Practical debugging skills
17_Redis_Redis发布订阅
Yolo format data set processing (XML to txt)
随机推荐
. Net again! Happy 20th birthday
Set set you don't know
MySQL -- Index Optimization -- order by
There are 7 seats with great variety, Wuling Jiachen has outstanding product power, large humanized space, and the key price is really fragrant
YOLOV5 代码复现以及搭载服务器运行
Leetcode skimming -- count the number of numbers with different numbers 357 medium
18_ Redis_ Redis master-slave replication & cluster building
How to solve the problem of database content output
Mavn builds nexus private server
Topology architecture of the minimum deployment of tidb cluster
QML pop-up frame, customizable
03. Preliminary use of golang
Redux——详解
How to test tidb with sysbench
LeetCode刷题——奇偶链表#328#Medium
Facing the challenge of "lack of core", how can Feiling provide a stable and strong guarantee for customers' production capacity?
搭建自己的语义分割平台deeplabV3+
FPGA - clock-03-clock management module (CMT) of internal structure of 7 Series FPGA
FPGA - 7系列 FPGA内部结构之Clocking -03- 时钟管理模块(CMT)
工程师评测 | RK3568开发板上手测试