Julho 06
Prof(s). Eduardo Bezerra & Ismael H. F. Santos                                                2
Tratamento de Exceção
nExemplo: leitura de arquivo
nimport java.io.*;
npublic class PrintFile {
n  public static void main(String[] args) {
n    try {
n      InputStream fin = new FileInputStream(args[0]);
n      InputStream in = new BufferedInputStream(fin);
n      int b;
n      while((b=in.read()) != -1) { System.out.print((char)b);}
n    } catch (IOException e) {
n      System.out.println(e);
n    } finaly {
n      if (fin != null) fin.close();
n    }
n  }                              Exercícios – Questão 10
n}