Try with multiple Resource in Java [duplicate]
This question already has an answer here: Close multiple resources with AutoCloseable (try-with-resources) 4 answers I am new in Java8 , and I want to know if, for the AutoCloseable resource, I have to add a try for each resource , or it will work with the code above try (Connection conn = getConnection();) { Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery(sql); while (rset.next()) { TelefonicaDataVO vo = new TelefonicaDataVO(); vo.setTelefonicaDataId(rset.getString("Telefonica_PSD_ID")); vo.setReceptionDate(nvl(rset.getTimestamp("CREATION_DATE"))); vo.setMessage