?
package com.javarush.task.task16.task1630;
import java.io.*;
public class Solution {
public static String firstFileName;
public static String secondFileName;
//add your code here - добавьте код тут
public static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
static {
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();
f.join();
//add your code here - добавьте код тут
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 textFile = "";
private InputStream fileReader;
@Override
public void setFileName(String fullFileName) {
this.fullFileName = fullFileName;
}
@Override
public void run() {
try {
fileReader = new FileInputStream(fullFileName);
while (fileReader.available() > 0) {
char c = (char) fileReader.read();
textFile = textFile + c;
}
fileReader.close();
} catch (IOException e) {}
}
@Override
public String getFileContent() {
return textFile;
}
}
}