Order catch blocks when try to handle an exception

前端 未结 5 1239
你的背包
你的背包 2020-12-19 14:05
try
{
    // throws IOException
}
catch(Exception e)
{
}
catch(IOException e)
{
}

when try block throws IOException, it wi

5条回答
  •  孤城傲影
    2020-12-19 14:15

    They are catched in the order you specify. In your case you should put IOException above Exception. Always keep Exception as last.

提交回复
热议问题