closable resources java

Solutions on MaxInterview for closable resources java by the best coders in the world

showing results for - "closable resources java"
Nils
09 Jan 2021
1try (Scanner scanner = new Scanner(new File("test.txt"))) {
2    while (scanner.hasNext()) {
3        System.out.println(scanner.nextLine());
4    }
5} catch (FileNotFoundException fnfe) {
6    fnfe.printStackTrace();
7}
similar questions
queries leading to this page
closable resources java