/* Copyright 2005 Daniel Cer (daniel.cer@cs.colorado.edu) This work is licensed under the Creative Commons Attribution-NonCommercial- ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.5/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA. */ import java.io.FileReader; import java.io.BufferedReader; public class DisplayFiles { public static void main(String[] args) throws Exception { for (int fileIdx = 0; fileIdx < args.length; fileIdx++) { System.out.printf("\n%s:\n", args[fileIdx]); BufferedReader reader = new BufferedReader(new FileReader(args[fileIdx])); for (String inLine; (inLine = reader.readLine()) != null; ) System.out.println(inLine); reader.close(); } } }