import java.io.*;public class MainException
{
   //Pass all exceptions to the console:
   public static void f()
   {
       //Open the file:
        try{
        FileInputStream file = 
          new FileInputStream("Cleanup.java");
         
         
        // Use the file...
        // Close the file:
        file.close();
           }
        catch(Exception e)
         {
              throw new RuntimeException(e);
         }
   }
   public static void main(String[] args) //throws Exception
   {
      try{
          f();
      }
        
      catch(RuntimeException re)
      {
          try
          {
               throw re.getCause();
          }
          catch(FileNotFoundException e)
          {
               System.out.println(e);
          }
          catch(IOException e)
          {
               System.out.println(e);
          }
          catch(Throwable e)
          {
               System.out.println(e);
          }
      }
   }
}
请问一下,我使用RuntimeException的getCause()方法,为什么不能输出各个异常的名字呢?要是在f()方法中撤去try类型检查和catch子句,将编译不过去,输出IOException和FileNotFoundException. 我将这两种异常打包成了RuntimeException,不是说RuntimeException编译器不需要异常说明,能直接调用其printStackTrace()方法么?为什么我在输出中没看到任何信息呢?求高手帮忙,非常感谢!!!!