Code /* TestException8.java CIS 260 Dave Klick 2016-02-03 This program shows how to use the try-with-resources constuct. It takes care of automatically closing the resource. */ import java.io.*; public class TestException8 { public static void main(String[] args) { String line; for (String fname : args) { System.out.println("Processing file: " + fname); try { try (BufferedReader br = new BufferedReader(new FileReader(fname))) { while ((line = br.readLine()) != null) System.out.println(line); } System.out.println(); } catch (IOException e) { System.out.println("I/O error: " + e.getMessage()); } } } }