题目内容:
试写出下面这个程序的执行结果. class ExceptionTest {
static String a[] = {"123", "abc", null};
public static void main (String args[]) {
for (int i = 0; i < 3; i++) {
try {
int x = Integer.parseInt(a[i]);
System.out.println( "Result: " + x);
}
catch(NullPointerException e) {
System.out.println("error null:");}
catch (NumberFormatException e)
{System.out.println("error:abc" );}
finally{System.out.println ("In "+ i +"th loop\n"); }
} //end for
}
}
参考答案: