Проверил вывод текста файлов: Выдаёт, всё ок.
package com.javarush.task.task16.task1630;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
public class Solution {
public static String firstFileName;
public static String secondFileName;
//add your code here - добавьте код тут
static {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
try {
firstFileName = reader.readLine();
secondFileName = reader.readLine();
}catch(IOException e){
e.printStackTrace();
}
}
public static void main(String[] args) throws InterruptedException {
systemOutPrintln(firstFileName);
systemOutPrintln(secondFileName);
}
public static void systemOutPrintln(String fileName) throws InterruptedException {
ReadFileInterface f = new ReadFileThread();
f.setFileName(fileName);
f.start();
//add your code here - добавьте код тут
f.join();
System.out.println(f.getFileContent());
}
public interface ReadFileInterface extends Runnable{
void setFileName(String fullFileName);
String getFileContent();
void join() throws InterruptedException;
void start();
}
//add your code here - добавьте код тут
public static class ReadFileThread implements ReadFileInterface {
protected String fullFileName;
@Override
public void run() {
String solution = getFileContent();
Thread.currentThread().interrupt();
}
@Override
public void join() {
}
public void start(){
}
public String getFileContent(){
String result = "";
try {
List<String> lines = Files.readAllLines(Paths.get(fullFileName), StandardCharsets.UTF_8);
for(String line: lines){
result+=line.concat(" ");
}
}catch (IOException e){
e.printStackTrace();
}
return result;
}
@Override
public void setFileName(String fullFileName) {
this.fullFileName = fullFileName;
}
}
}