?? throwsexception.java
字號:
public class throwsException
{ public static void main(String args[ ])
{ try
{ Method(0);
Method(1);
}
catch(NumberFormatException e)
{ System.out.println("\t 捕獲異常:"+e);}
catch(ArrayIndexOutOfBoundsException e)
{ System.out.println("\t 捕獲異常:"+e);}
finally
{ System.out.println("\t finally 塊總是被執(zhí)行。");}
}
static void Method(int i) throws ArithmeticException,NumberFormatException
{ System.out.println("\t 調(diào)用方法 Method("+i+")");
if(i==0)
{ System.out.println("\t 沒有異常事件");
return;
}
else if(i==1)
{ String str="abc";
int k;
k=Integer.parseInt(str);
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -