why doesn't the test seem to recognize the fact that i am using a try resource block that will close the fileinputstream automatically? are we note supposed to use try resource blocks anymore?
package com.codegym.task.task13.task1326;
import java.io.*;
import java.util.*;
/*
Sorting even numbers from a file
*/
public class Solution {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String filename = scan.nextLine();
scan.close();
File file = new File(filename);
byte[] bytes = new byte[(int) file.length()];
try (FileInputStream fis = new FileInputStream(file)) {
//noinspection ResultOfMethodCallIgnored
fis.read(bytes);
} catch (Exception e) { e.printStackTrace(); }
String[] s = new String(bytes).split("\\s+");
List<Integer> list = new ArrayList<>();
for (String num : s) list.add(Integer.parseInt(num));
Collections.sort(list);
list.stream().filter(f -> f % 2 == 0).forEach(System.out::println);
}
}