1.假设类IOException是类Exception的子类,请指出下列程序执行时标准输出显示的内容。import java.io.*;
class ExceptionTest {
public void trythis() {
try {
System.out.println("1");
throw new IOException();
} catch (Exception e1) {
System.out.println("2");
} finally {
System.out.println("3");
}
System.out.println("4");
}
public static void main(String[] args) {
ExceptionTest et = new ExceptionTest();
et.trythis();
}
}
class ExceptionTest {
public void trythis() {
try {
System.out.println("1");
throw new IOException();
} catch (Exception e1) {
System.out.println("2");
} finally {
System.out.println("3");
}
System.out.println("4");
}
public static void main(String[] args) {
ExceptionTest et = new ExceptionTest();
et.trythis();
}
}
1 2 3 4