Skip to content

Commit 692cef8

Browse files
fix: Surrounded with try with resources (iluwatar#1983)
Co-authored-by: Mohana Rao S V <[email protected]>
1 parent 4cdc309 commit 692cef8

File tree

1 file changed

+4
-3
lines changed
  • execute-around/src/main/java/com/iluwatar/execute/around

1 file changed

+4
-3
lines changed

execute-around/src/main/java/com/iluwatar/execute/around/App.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ public static void main(String[] args) throws IOException {
5353
new SimpleFileWriter("testfile.txt", writeHello);
5454

5555
// print the file contents
56-
var scanner = new Scanner(new File("testfile.txt"));
57-
while (scanner.hasNextLine()) {
58-
LOGGER.info(scanner.nextLine());
56+
try (var scanner = new Scanner(new File("testfile.txt"))) {
57+
while (scanner.hasNextLine()) {
58+
LOGGER.info(scanner.nextLine());
59+
}
5960
}
6061
}
6162
}

0 commit comments

Comments
 (0)