f "run" is not started, ro returns an empty String.
The program also returns 2 files.
Where doesn't it work?
package pl.codegym.task.task16.task1630;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public class Solution {
public static String firstFileName;
public static String secondFileName;
static {
Scanner scanner = new Scanner(System.in);
firstFileName = scanner.nextLine();
secondFileName = scanner.nextLine();
}
//tutaj wpisz swój kod
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();
// //tutaj wpisz swój kod
f.join();
System.out.println(f.getFileContents());
}
public interface ReadFileInterface {
void setFileName(String fullFileName);
String getFileContents();
void join() throws InterruptedException;
void start();
}
public static class ReadFileThread extends Thread implements ReadFileInterface {
String setFName = "";
int a = 0;
@Override
public void run() {
setFileName(setFName);
getFileContents();
}
@Override
public void setFileName(String fullFileName) {
this.setFName = fullFileName;
}
@Override
public String getFileContents() {
return setFName;
}
@Override
public void start() {
}
//tutaj wpisz swój kod
}
}