2009. 11. 11. 01:15
Changing JAVA jre 삽질예방/Java2009. 11. 11. 01:15
Right click on project name and choose properties -> Run/Debug Settings -> Edit (or duplicate and edit) -> JRE tab
static void f(int k, int[] A, String S) {
int j = 1 / k;
int len = A.length + 1;
char c;
try {
c = S.charAt(0);
if (k == 10) j = A[3];
} catch (ArrayIndexOutOfBoundsException ex) {
System.out.println("array error");
throw new InternalError();
} catch (ArithmeticException ex) {
System.out.println("arithmetic error");
} catch (NullPointerException ex) {
System.out.println("null ptr");
} finally {
System.out.println("in finally clause");
}
System.out.println("after try block");
}
Part A: Assume that variable X is an array of int that has been initialized to be of length 3. For each of the following calls to method f, say what (if anything) is printed by f and what, if any, uncaught exceptions are thrown by f.