Answers for "closable resources java"

0

closable resources java

try (Scanner scanner = new Scanner(new File("test.txt"))) {
    while (scanner.hasNext()) {
        System.out.println(scanner.nextLine());
    }
} catch (FileNotFoundException fnfe) {
    fnfe.printStackTrace();
}
Posted by: Guest on August-26-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language