(String[] args)
| 6 | |
| 7 | public class TryWithResources { |
| 8 | public static void main(String[] args) { |
| 9 | try( |
| 10 | InputStream in = new FileInputStream( |
| 11 | new File("TryWithResources.java")) |
| 12 | ) { |
| 13 | int contents = in.read(); |
| 14 | // Process contents |
| 15 | } catch(IOException e) { |
| 16 | // Handle the error |
| 17 | } |
| 18 | } |
| 19 | } |