Skip to content

Instantly share code, notes, and snippets.

@nwillc
Created October 25, 2018 00:30
Show Gist options
  • Save nwillc/b45efd47cd6243995670b97c819f1e31 to your computer and use it in GitHub Desktop.
Save nwillc/b45efd47cd6243995670b97c819f1e31 to your computer and use it in GitHub Desktop.
Java try with resources with multiple resources
try (Reader reader = new FileReader("input.txt");
Writer writer = new FileWriter("output.txt")) {
// Use the input and output
} catch (FileNotFoundException e) {
// Handle possible exception
} catch (IOException e2) {
// Handle another exception
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment