We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4cdc309 commit 692cef8Copy full SHA for 692cef8
execute-around/src/main/java/com/iluwatar/execute/around/App.java
@@ -53,9 +53,10 @@ public static void main(String[] args) throws IOException {
53
new SimpleFileWriter("testfile.txt", writeHello);
54
55
// print the file contents
56
- var scanner = new Scanner(new File("testfile.txt"));
57
- while (scanner.hasNextLine()) {
58
- LOGGER.info(scanner.nextLine());
+ try (var scanner = new Scanner(new File("testfile.txt"))) {
+ while (scanner.hasNextLine()) {
+ LOGGER.info(scanner.nextLine());
59
+ }
60
}
61
62
0 commit comments