class ex1
{
static void my() {
System.out.println("asdsdf");
}
public static void main(String args[]) {
try {
for (;;) {
my();
}
} catch (Exception e)//Exception is not caught //Line 1
{
System.out.println("Overflow caught");
} finally {
System.out.println("In Finally");
}
System.out.println("After Try Catch Finally...");
}
}
catch 语句(第 1 行)不处理溢出异常,因为输出继续打印“asdsdf”而不抛出异常。谁能告诉我为什么不将无限循环作为异常处理?或者这就是它的设计和应该工作的方式?