当前位置:网站首页>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 :

边栏推荐
- LeetCode_ String_ Simple_ 412.Fizz Buzz
- Evaluation of embedded rz/g2l processor core board and development board of Feiling
- LeetCode刷题——递增的三元子序列#334#Medium
- 02. After containerization, you must face golang
- 02_线性表_顺序表
- PHP method to get the index value of the array item with the largest key value in the array
- 12_ Redis_ Bitmap_ command
- List set & UML diagram
- 5. Practice: jctree implements the annotation processor at compile time
- How to choose a third-party software testing organization for automated acceptance testing of mobile applications
猜你喜欢

04_ 栈

做好抗“疫”之路的把关人——基于RK3568的红外热成像体温检测系统

Bing.com网站

How does the computer set up speakers to play microphone sound

工程师评测 | RK3568开发板上手测试

Bing. Site Internet

Learn the method code example of converting timestamp to uppercase date using PHP

LeetCode刷题——奇偶链表#328#Medium

Application and practice of Jenkins pipeline

Kibana basic operation
随机推荐
LeetCode刷题——统计各位数字都不同的数字个数#357#Medium
Apprendre le Code de la méthode de conversion du calendrier lunaire grégorien en utilisant PHP
Build your own semantic segmentation platform deeplabv3+
Force deduction solution summary 2029 stone game IX
Pytorch 保存tensor到.mat文件
10_ Redis_ geospatial_ command
12_Redis_Bitmap_命令
搭载TI AM62x处理器,飞凌FET6254-C核心板首发上市!
Application of CDN in game field
原则、语言、编译、解释
02.面向容器化后,必须面对golang
17_ Redis_ Redis publish subscription
Beijing rental data analysis
vChain: Enabling Verifiable Boolean Range Queries over Blockchain Databases(sigmod‘2019)
15_ Redis_ Redis. Conf detailed explanation
MD5加密
哈夫曼树:(1)输入各字符及其权值(2)构造哈夫曼树(3)进行哈夫曼编码(4)查找HC[i],得到各字符的哈夫曼编码
04_ 栈
TiDB数据迁移工具概览
Recommended configuration of tidb software and hardware environment