?? failingconstructor22.java
字號:
// exceptions/FailingConstructor22.java
// TIJ4 Chapter Exceptions, Exercise 22, page 488
/* Create a class called FailingConstructor with a constructor that might fail
* partway through the construction process and throw an exception. In main(),
* write code that properly guards against this failure.
*/
public class FailingConstructor22 {
Integer[] ia = new Integer[2];
String s;
FailingConstructor22(String s) throws Exception {
ia[0] = 0;
ia[1] = 1;
ia[2] = 2;
this.s = s;
}
public static void main(String[] args) {
try {
FailingConstructor22 fc = new FailingConstructor22("hi");
} catch(Exception e) {
System.err.println("Caught Exception in main()");
e.printStackTrace(System.err);
} finally {
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -