public static void main(String args[]) throws Exception{
try{
int i = 5/0;
}catch(InterruptedException e){
System.out.print("ie ");
}catch(RuntimeException e){
System.out.print("re ");
}
}请问以上代码,为什么编译的时候不过呢InterruptedException 到底是个怎样的东西啊
try{
int i = 5/0;
}catch(InterruptedException e){
System.out.print("ie ");
}catch(RuntimeException e){
System.out.print("re ");
}
}请问以上代码,为什么编译的时候不过呢InterruptedException 到底是个怎样的东西啊
解决方案 »
- No report config file!错误了 ,怎么办啊 !!!!急急急急!!!!
- Struts-2.1.6整合Tiles2全攻略,遇到问题的朋友进来看下,也许对你有帮助!
- 关于360安全浏览器 下载word后 报丢失css错误
- 高手请进,MM求助,-----MM求助啊,anyURI
- struts2.3.4+hibernate4.18+spring3.2 自动创建外键关联失败,创建序列失败!
- java新人,请帮我解释下如下的代码程序
- 准备换换工作了,兄弟们给点建议
- 在线等,很菜鸟的web service问题
- 请问EJB中怎么实现定时器功能,在每天的0:00执行一次操作。
- java上传图片功能,改变图片大小。
- spring 方法增强的奇怪问题
- 请教各位大侠!
try{
int i = 5/0;
}
catch(RuntimeException e){
System.out.print("re ");
}这样 就可以,你那个异常 线程处理时候 比较多,你这个不会,
我当然知道这个可以了我想问的是为什么加了
catch(InterruptedException e)
编译不能通过也就是我想知道InterruptedException 异常类怎么用阿
原因是:
Unreachable catch block for InterruptedException. This exception is never thrown from the try statement body
呵呵
还是谢谢了
现在明白了
只有在try代码块中有可能抛出的异常才能在catch中捕捉
否则编译不能通过