package com.javarush.task.task16.task1630; import java.io.*; 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, IOException { systemOutPrintln(firstFileName); systemOutPrintln(secondFileName); } public static void systemOutPrintln(String fileName) throws InterruptedException, IOException { ReadFileInterface f = new ReadFileThread(); f.setFileName(fileName); f.start(); f.join(); //add your code here - добавьте код тут System.out.println(f.getFileContent()); } public interface ReadFileInterface { void setFileName(String fullFileName) throws IOException, InterruptedException; String getFileContent() throws IOException, InterruptedException; void join() throws InterruptedException; void start(); } public static class ReadFileThread extends Thread implements ReadFileInterface { private String fullFileName; private String str1 = ""; @Override public void setFileName(String fullFileName){ this.fullFileName = fullFileName; } @Override public String getFileContent() { return str1; } @Override public void run() { try { FileInputStream fstream = new FileInputStream(fullFileName); BufferedReader reader1 = new BufferedReader(new InputStreamReader(fstream)); while (reader1.readLine() != null){ str1+= reader1.readLine() + " "; } fstream.close(); reader1.close(); System.out.println(str1); } catch (IOException e){ System.out.println(e); } } } //add your code here - добавьте код тут }