import java.util.Scanner; import java.io.File; import java.io.FileNotFoundException; class Cat { public static void main(String[] args) { if (args.length >= 1) { String filename = args[0]; try { // FileNotFoundException can be raised Scanner s = new Scanner(new File(filename)); while (s.hasNextLine()) { System.out.println(s.nextLine()); } s.close(); } catch (FileNotFoundException e) { System.out.println("File not found!"); } } else System.out.println("Usage: java Cat "); } }