//tset3 2.算数异常:ArithmeticException
@Test
public void tset3(){
try{
int i=10;
System.out.println(i/0);
}catch(ArithmeticException e){
System.out.println(e.getMessage());
}
}

这没什么编译毛病;
看下面抛出大异常GG;
//tset3 2.算数异常:ArithmeticException
@Test
public void tset3(){
try{
int i=10;
System.out.println(i/0);
}catch(Exception e){
System.out.println(e.getMessage());
}
}

完全不能明白怎么回事,贼尴尬;
Exception不是最大的么?
为什么不能抛出。
No exception of type Exception can be thrown; an exception type must be a subclass of
UP主-1的英语水平,只能百度了。
不可以抛出类型异常,异常类型必须是.
WTF,怎么可能,我是最大的,你不接受,非要一个小的么?
我很受打击。正宫不要要小三。
up主用的是
myEclipse 10
JDK JAVA EE6.0自带的1.6
有的人可以编译成功用大异常。
我脸黑不行。
最后
以上就是温婉楼房最近收集整理的关于JAVA异常初级的懵逼之路的全部内容,更多相关JAVA异常初级内容请搜索靠谱客的其他文章。
发表评论 取消回复