当前位置:网站首页>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
边栏推荐
猜你喜欢
Spark 算子之distinct使用
糖尿病眼底病变综述概要记录
[AI weekly] NVIDIA designs chips with AI; The imperfect transformer needs to overcome the theoretical defect of self attention
MySQL - MySQL查询语句的执行过程
Spark 算子之partitionBy
You need to know about cloud disaster recovery
Coalesce and repartition of spark operators
How important is the operation and maintenance process? I heard it can save 2 million a year?
Spark 算子之交集、并集、差集
C, calculation method and source program of bell number
随机推荐
Day (3) of picking up matlab
【自娱自乐】构造笔记 week 2
Filter usage of spark operator
面试题 17.10. 主要元素
Day (5) of picking up matlab
一文读懂串口及各种电平信号含义
js正則判斷域名或者IP的端口路徑是否正確
Spark 算子之groupBy使用
Ice -- source code analysis
Config learning notes component
下载并安装MongoDB
linux上启动oracle服务
299. Number guessing game
OAK-D树莓派点云项目【附详细代码】
Day (9) of picking up matlab
Day (2) of picking up matlab
Intersection, union and difference sets of spark operators
Config组件学习笔记
Day (7) of picking up matlab
What is the experience of using prophet, an open source research tool?