?? multicatch.java
字號:
//multiCatch.Java
public class multiCatch
{
public static void main(String[ ] args) {
method(0);
method(1);
method(2);
}
public static void method(int i) {
System.out.println("In situation "+i);
try {
if (i==0) {
System.out.println("no exception");
return;
}
else if (i==1) {
int n=0;
int m=2/n;
}
else if(i==2){
int a[]=new int[3];
a[3]=10;
}
}
catch (ArithmeticException e) {
System.err.println("catch "+e);
}
catch (ArrayIndexOutOfBoundsException e) {
System.err.println("catch "+e.getMessage());
}
catch (Exception e) {
System.err.println("Will not be executed ");
}
finally{
System.err.println("In method finally ");
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -