当前位置:网站首页>Day 10 abnormal mechanism
Day 10 abnormal mechanism
2022-04-23 16:08:00 【Students Mr sun】








Example :

-- Exception capture level



throw Used in methods throwd Throw an exception on a method 
package oop.exception;
public class Demo1 {
public static void main(String[] args) {
int a=1;
int b=0;
//ctrl+alt+t Exception shortcut
// Capture exception
try {
System.out.println(a / b);
} catch (Error e) {
System.out.println("Error");
// Printing exception e.printStackTrace();
}
catch (Exception e) {
System.out.println("Exception");
} catch (Throwable e) {
System.out.println("Throwable");
}
finally {
System.out.println("finally");
}
//test Method
try {
test(1,0);
} catch (ArithmeticException e) {
System.out.println("asdasfasfasfas");
} finally {
System.out.println("finally");
}
}
public static void test(int a,int b) throws ArithmeticException {
if (b==0) {
System.out.println("asd");
throw new ArithmeticException();
}
}
}
Custom exception



版权声明
本文为[Students Mr sun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231602157310.html
边栏推荐
- Grbl learning (I)
- js正则判断域名或者IP的端口路径是否正确
- Government cloud migration practice: Beiming digital division used hypermotion cloud migration products to implement the cloud migration project for a government unit, and completed the migration of n
- What is the experience of using prophet, an open source research tool?
- PS add texture to picture
- Day (6) of picking up matlab
- 力扣-746.使用最小花费爬楼梯
- What is cloud migration? The four modes of cloud migration are?
- Spark 算子之distinct使用
- 5 minutes, turn your excel into an online database, the magic cube net table Excel database
猜你喜欢

homwbrew安装、常用命令以及安装路径

C language self compiled string processing function - string segmentation, string filling, etc

Partitionby of spark operator

新动态:SmartMesh和MeshBox的合作新动向

Hypermotion cloud migration completes Alibaba cloud proprietary cloud product ecological integration certification
![Oak-d raspberry pie cloud project [with detailed code]](/img/03/2d464d42614cd65877c645b60047ae.png)
Oak-d raspberry pie cloud project [with detailed code]

运维流程有多重要,听说一年能省下200万?

Best practice of cloud migration in education industry: Haiyun Jiexun uses hypermotion cloud migration products to implement progressive migration for a university in Beijing, with a success rate of 1

How can poor areas without networks have money to build networks?

Groupby use of spark operator
随机推荐
C, calculation method and source program of bell number
Homewbrew installation, common commands and installation path
Implement default page
Solution to the fourth "intelligence Cup" National College Students' IT skills competition (group B of the final)
Meaning and usage of volatile
Grbl learning (I)
Day (6) of picking up matlab
What is cloud migration? The four modes of cloud migration are?
C#,贝尔数(Bell Number)的计算方法与源程序
Six scenarios of cloud migration
力扣-746.使用最小花费爬楼梯
Passing header request header information between services through feign
Government cloud migration practice: Beiming digital division used hypermotion cloud migration products to implement the cloud migration project for a government unit, and completed the migration of n
力扣-198.打家劫舍
TIA botu - basic operation
Intersection, union and difference sets of spark operators
linux上啟動oracle服務
js正则判断域名或者IP的端口路径是否正确
How to upgrade openstack across versions
Coalesce and repartition of spark operators