new*_*ain 1 java exception-handling exception core
如果我在catch块中编写RunTimeException,那么为什么不处理它.
class main{
public static void main(String cs[]){
try{
int a = 10/0;
}
catch(RunTimeException e){
System.out.println("exception caught");
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,如果我写RunTimeException会出现错误,如果我写了RunTimeException的子类,即ArithmaticException和超类Exception.
错误是
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
RunTimeException cannot be resolved to a type
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1258 次 |
| 最近记录: |