Не проходит по пункту с методом run()
Пишет: " Убедись что метод getFileContent возвращает пустую строку, если метод run не запускался. "
Не понимаю как это сделать
package com.javarush.task.task16.task1630;
import java.io.*;
public class Solution {
public static String firstFileName;
public static String secondFileName;
static {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
firstFileName = reader.readLine();
secondFileName = reader.readLine();
reader.close();
} catch (IOException e){
}
}
public static class ReadFileThread extends Thread implements ReadFileInterface {
public String fullFileName;
public String st="";
@Override
public void setFileName(String fullFileName) {
this.fullFileName = fullFileName;
}
@Override
public String getFileContent() throws IOException{
BufferedReader r = new BufferedReader(new FileReader(this.fullFileName));
String s;
while ((s=r.readLine())!=null){
st = st + s + " ";
}
r.close();
return st;
}
@Override
public void run(){
this.setFileName(this.fullFileName);
try {
this.getFileContent();
} 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();
System.out.println(f.getFileContent());
}
public interface ReadFileInterface {
void setFileName(String fullFileName);
String getFileContent() throws IOException;
void join() throws InterruptedException;
void start();
}
//add your code here - добавьте код тут
}