我想在内部try中嵌套一个try catch,而不需要在内部try中添加catch。
例如:
try (Connection conn = new Connection()) {
//Fill preparedStatement etc
try (ResultSet rs = conn.execute()){
}
} catch (SQLException e) {
//Log both exceptions here
}
这是否可行并且是否是一个好的实践方法?