в чем беда?
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) {
}
}
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 {
void setFileName(String fullFileName);
String getFileContent();
void join() throws InterruptedException;
void start();
}
//add your code here - добавьте код тут
public static class ReadFileThread extends Thread implements ReadFileInterface {
private String fullFileName;
private String fileContent = "";
public void setFileName(String fullFileName) {
this.fullFileName = fullFileName;
}
public String getFileContent() {
return this.fileContent;
}
@Override
public void run() {
try {
BufferedReader fileReader = new BufferedReader(new FileReader(new File(this.fullFileName)));
String line = fileReader.readLine();
while (line != null) {
this.fileContent += line;
line = " " + fileReader.readLine();
}
fileReader.close();
} catch (FileNotFoundException e) {
} catch (IOException e) {
}
}
}
}