(String[] args)
| 6 | |
| 7 | public class MessyExceptions { |
| 8 | public static void main(String[] args) { |
| 9 | InputStream in = null; |
| 10 | try { |
| 11 | in = new FileInputStream( |
| 12 | new File("MessyExceptions.java")); |
| 13 | int contents = in.read(); |
| 14 | // Process contents |
| 15 | } catch(IOException e) { |
| 16 | // Handle the error |
| 17 | } finally { |
| 18 | if(in != null) { |
| 19 | try { |
| 20 | in.close(); |
| 21 | } catch(IOException e) { |
| 22 | // Handle the close() error |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | } |