缩略语 条款援引<代码>System.exit()。
public static void main(String[] args) {
try {
Integer.valueOf("NotANumber");
} finally {
System.out.println("finally");
System.exit(0);
}
}
产出
finally
如果从最后删除<代码>System.exit(0),那么产出就是
finally
Exception in thread "main" java.lang.NumberFormatException: For input string: "NotANumber"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:449)
at java.lang.Integer.valueOf(Integer.java:554)
at exception.MyExcepTest.main(MyExcepTest.java:20)
Where "finally" may appears before, after or in between the meesage of NumberFormatException
.
Can anybody explain it?