异常输出顺序不同...
环境: eclipse2.1.3
jre: 1.4.2_05
代码:
public class TestException {
static void g() throws IOException {
throw new IOException("throw from g()");
}
public void h() throws IOException {
throw new IOException("throw from h()");
}
public static void main(String[] args) {
System.out.println("Start main()!!!");
try {
g(); // 1
// new TestException().h(); // 2
}
catch (IOException e) {
System.err.println(e);
}
System.out.println("End main()");
}
}
请教,为什么两次的输出顺序不同??
注释掉2,结果是:
java.io.IOException: throw from g()
Start main()!!!
End main()
注释掉1,结果是:
Start main()!!!
End main()
java.io.IOException: throw from h()