cry catch 基本用法
来源:互联网 发布:seo外链在线群发 编辑:程序博客网 时间:2024/06/07 09:36
class DivisorIsZeroException extends Exception{
public DivisorIsZeroException(String errorMessage){
super(errorMessage);
}
}
class A{
int divide(int a,int b){
try{
if(0==b)
throw new DivisorIsZeroException("hahaha");
}
catch(DivisorIsZeroException e){
e.printStackTrace();
}
int m=a/b;
return m;
}
}
public class TestA{
public static void main(String[] args){
A aa=new A();
int W=aa.divide(6,0);
System.out.printf("%d\n",W);
}
}
public DivisorIsZeroException(String errorMessage){
super(errorMessage);
}
}
class A{
int divide(int a,int b){
try{
if(0==b)
throw new DivisorIsZeroException("hahaha");
}
catch(DivisorIsZeroException e){
e.printStackTrace();
}
int m=a/b;
return m;
}
}
public class TestA{
public static void main(String[] args){
A aa=new A();
int W=aa.divide(6,0);
System.out.printf("%d\n",W);
}
}
阅读全文
1 0
- cry catch 基本用法
- cry
- c++中 try catch throw的基本用法【by徐玉丽】
- try catch throw用法
- try catch 用法
- try catch throw用法
- try catch finally用法
- try catch throw用法
- try catch throw用法
- try catch throw用法
- try catch throw用法
- try catch throw用法
- try catch finally 用法
- try、catch、finally用法
- try catch finally 用法
- try catch throw用法
- try catch finally 用法
- try catch finally 用法
- 用python爬取小说信息(简易版)
- 工作中常用的sql语句
- Qt 学习之路 2(4):信号槽
- c++STL链表模板使用
- Leetcode451. 对字符出现频率进行排序
- cry catch 基本用法
- jsp时间显示代码块
- EXP-00056: 遇到 ORACLE 错误 12154 ORA-12154: TNS: 无法解析指定的连接标识符
- java反射机制基本用法(附:帮助文档)
- Linux学习笔记001
- equals重写
- 前端拼接id传到后台
- NYOJ
- 线程案例-卖票1-实现