?? chap7-4.txt
字號:
// 程序7-4
public class ThrowException{
public static void Test( ) {
try{
int c[ ]=new int[10];
c[10]=0;
}catch(ArrayIndexOutOfBoundsException e) {
System.out.println("\t 數組下標越界!");
throw e; // 將該異常對象提交給main方法進行處理
// System.out.println("\t產生異常后!"); // 該行無法通過編譯
}
}
public static void main(String args[ ]) {
try{
Test( );
}catch(IndexOutOfBoundsException e) { // 處理Test方法提交的異常
System.out.println("\t 下標越界!");
}finally{
System.out.println("\t 在finally塊中!");
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -