有没有一种优雅的方法来处理在 finally
块中抛出的异常?
例如:
try {
// Use the resource.
}
catch( Exception ex ) {
// Problem with the resource.
}
finally {
try{
resource.close();
}
catch( Exception ex ) {
// Could not close the resource?
}
}
如何避免 finally
块中的 try
/catch
?