The Java Program: Trace.java
1
2
3
4
5
6
7
8 import java.io.FileInputStream;
9 import java.io.FileNotFoundException;
10 import java.io.IOException;
11
12 public class Trace {
13
14 public static void main (String args[]) {
15
16 try {
17
18 final int n = Integer.valueOf(args[0]).intValue();
19 FileInputStream in = new FileInputStream (args[n]);
20 in = null;
21 in.close ();
22
23 } catch (ArrayIndexOutOfBoundsException e) {
24 e.printStackTrace (System.err);
25
26 } catch (NumberFormatException e) {
27 e.printStackTrace (System.err);
28
29 } catch (FileNotFoundException e) {
30 e.printStackTrace (System.err);
31
32 } catch (IOException e) {
33 e.printStackTrace (System.err);
34
35 } catch (NullPointerException e) {
36 e.printStackTrace (System.err);
37
38 }
39 }
40 }