Close multiple resources with AutoCloseable (try-with-resources)

Try with resources can be used with multiple resources by declaring them all in the parenthesis. See the documentation Relevant code excerpt from the linked documentation: public static void writeToFileZipFileContents(String zipFileName, String outputFileName) throws java.io.IOException { java.nio.charset.Charset charset = java.nio.charset.StandardCharsets.US_ASCII; java.nio.file.Path outputFilePath = java.nio.file.Paths.get(outputFileName); // Open zip file and create output file with // try-with-resources … Read more