не проходит 3 и 5 пункт.
НЕ понимаю, в 3 пункте: если не инициировать переменную типа String ее значение же равно null. Поэтому если fileContent не будет изменяться в run, разве строка return fileContent.trim() не должна вернуть null?
package com.javarush.task.task16.task1630;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
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();
} catch (IOException e) {
e.printStackTrace();
}
}//add your code here - добавьте код тут
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();
}
public static class ReadFileThread extends Thread implements ReadFileInterface {
public static String fullFileName;
public String string;
public String fileContent;
public void setFileName(String fullFileName){
this.fullFileName = fullFileName;
}
public String getFileContent(){
return fileContent.trim();
}
public void run(){
try{
BufferedReader reader=new BufferedReader(new InputStreamReader(new FileInputStream(fullFileName)));
while(!(string = reader.readLine()).equals(null)){
string = reader.readLine();
fileContent = fileContent + string + " ";
}
reader.close();
}catch(IOException e){
e.printStackTrace();
}
}
public void start(){
}
}//add your code here - добавьте код тут
}