Всем привет! подскажите пж почему не проходит требование "Потоки для чтения и записи должны быть закрыты.". я же добавил в блок try-with-resources все что должно быть закрыто
package com.javarush.task.pro.task15.task1505;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.Scanner;
/*
Что-то не копируется...
*/
public class Solution {
public static void main(String[] args) {
try (Scanner scanner = new Scanner(System.in);
var inputStream = Files.newInputStream(Paths.get(scanner.nextLine()), StandardOpenOption.READ);
var outputStream = Files.newOutputStream(Paths.get(scanner.nextLine()))
) {
int size = 1024;
byte[] buffer = new byte[size];
int read;
while ((read = inputStream.read(buffer, 0, size)) != -1) {
outputStream.write(buffer, 0, read);
}
} catch (Exception e) {
System.out.println("Something went wrong : " + e);
}
}
}