集册 Java实例教程 使用带有try catch的finally块

使用带有try catch的finally块

欢马劈雪     最近更新时间:2020-01-02 10:19:05

684
无论try块是否抛出任何异常或任何catch块捕获了任何异常,都将执行finally块。
/*n o w  j a v a  . c o m 提 供*/

try

{

      statements that can throw exceptions

}

catch (exception-type identifier)

{

      statements executed when exception is thrown

}

finally

{

      statements that are executed whether or not exceptions occur

}