| 6 | |
| 7 | public class Cleanup { |
| 8 | public static void main(String[] args) { |
| 9 | try { |
| 10 | InputFile in = new InputFile("Cleanup.java"); |
| 11 | try { |
| 12 | String s; |
| 13 | int i = 1; |
| 14 | while((s = in.getLine()) != null) |
| 15 | ; // Perform line-by-line processing here... |
| 16 | } catch(Exception e) { |
| 17 | System.out.println("Caught Exception in main"); |
| 18 | e.printStackTrace(System.out); |
| 19 | } finally { |
| 20 | in.dispose(); |
| 21 | } |
| 22 | } catch(Exception e) { |
| 23 | System.out.println( |
| 24 | "InputFile construction failed"); |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | /* Output: |
| 29 | dispose() successful |