假设类EOFException是类IOException的子类,而类IOException又是Exception的子类,请指出下列程序)执行时标准输出显示的内容。

发布时间:2020-07-31 03:24:45

问题补充:

import java.io.*;

 

class ExceptionTest {

 public void trythis() {

   try {

         System.out.println("1");

         throw new EOFException();

   } catch (IOException e1) {

         System.out.println("2");

   } catch (Exception e2) {

         System.out.println("3");

   } finally {

         System.out.println("4");

   }

   System.out.println("5");

 }

 

 public static void main(String[] args) {

   ExceptionTest et = new ExceptionTest();

   et.trythis();

 }

}


网友回答

答案:程序打印的结果为:
1
2
4
5
以上问题属网友观点,不代表本站立场,仅供参考!