以上3种异常的stackTrace有什么差别吗?

解决方案 »

  1.   

    可能是我说的不清楚,打个比方吧
    public void deleteFile(File file) throws FileNotExistException
    {
        if(!file.exists())
        {
            throw new FileNotExistException("这个文件不存在");
        }
        file.delete();
    }
      

  2.   

    这好像涉及到底层函数,jdk中没看见过。
      

  3.   

    你在自定义的异常上多个属性来说明是什么异常不是可以了。
    public void deleteFile(File file) throws FileNotExistException
    {
        if(!file.exists())
        {
            throw new FileNotExistException("这个文件不存在","file not exit");
        }
        file.delete();
    }