Подскажите, почему могут невыполняться требования?
Всё проверил на разных файлах, работает...
PS
изменил код на Input/Output
по тем же самым пунктам не могу пройти
уже неделю пытаюсь эту задачу решить и всё никак не принимает
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
String s1 = scanner.nextLine(); // Читаем имена фалов
String s2 = scanner.nextLine();
String s3 = scanner.nextLine();
scanner.close();
FileOutputStream outputStream = new FileOutputStream(s1);
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(outputStream, 200);
FileInputStream second = new FileInputStream(s2);
BufferedInputStream secondF = new BufferedInputStream(second, second.available());
FileInputStream third = new FileInputStream(s3);
BufferedInputStream thirdF = new BufferedInputStream(third, third.available());
while (secondF.available()>0){
bufferedOutputStream.write(secondF.read());
}
while (thirdF.available()>0) {
bufferedOutputStream.write(thirdF.read());
}
bufferedOutputStream.close();
secondF.close();
thirdF.close();package com.javarush.task.task18.task1818;
/*
Два в одном
*/
import java.util.*;
import java.io.*;
public class Solution {
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
String s1 = scanner.nextLine(); // Читаем имена фалов
String s2 = scanner.nextLine();
String s3 = scanner.nextLine();
scanner.close(); // Закрываем сканер
FileWriter fw = new FileWriter(new File(s1)); //отркыли поток для 1го файла
Scanner fileScanner1 = new Scanner(new File(s2)); //для второго
Scanner fileScanner2 = new Scanner(new File(s3)); // для третьего
while (fileScanner1.hasNextLine()){
fw.write(fileScanner1.nextLine()); // записали второй файл в первый
}
while (fileScanner2.hasNextLine()) {
fw.write(fileScanner2.nextLine()); //дописали третий в первый
}
fw.close(); // закрыли потоки
fileScanner1.close();
fileScanner2.close();
}
}