throws 跟在函数名后。
throw 在程序段中。

解决方案 »

  1.   

    gentoo说的非常对
    throws是将异常由函数抛给上一层而throw是在程序段中抛出异常,如下:public void method () throws Exception
    {
        try
        {
           File file = new File ("test.txt");
        }
        catch (Exception e)
        {
           throw e;
        }
    }
      

  2.   

    hnsdl() ,看到你的 File file = new File ("test.txt");
    我想再请教你一个问题:
      空目录(几内容为空的文件夹)可以用File.delete()来删除,那么非空的目录用什么来删除呢?