?? ex5(1).java
字號:
// exceptions/Ex5.java
// TIJ4 Chapter Exceptions, Exercise 5, page 452
/* Create you own resumption-like behavior using a while loop that repeats
* until an exception is no longer thrown.
*/
public class Ex5 {
private static int[] ia = new int[2];
static int x = 5;
public static void main(String[] args) {
while(true) {
try {
ia[x] = 1;
System.out.println(ia[x]);
break;
} catch(ArrayIndexOutOfBoundsException e) {
System.err.println(
"Caught ArrayIndexOutOfBoundsException");
e.printStackTrace();
x--;
} finally {
System.out.println("Are we done yet?");
}
}
System.out.println("Now, we're done.");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -