Sequential file output

  • 18
  • Locked
1. Figure out what the program does. 2. In a static block, read 2 filenames: firstFileName and secondFileName. 3. Inside the Solution class, create a public static ReadFileThread class that implements the ReadFileInterface interface (Think about what is more appropriate: Thread or Runnable). 3.1. Th
You can't complete this task, because you're not signed in.
Comments (4)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Agent Smith Level 38, Latvia
31 August 2020, 20:28
If you are stuck on a getFileName() returning an empty string or giving you a null pointer exception - just carefully think what happens first: 1) System.out.println(f.getFileContents()) being called or 2) f.start() getting finished? ;-)
Petros Level 23, Columbia, United States
14 August 2020, 21:22
The getFileName() method had be stuck. It just acts as a getter apparently (duh lol) but I was stuck on it for a while. You just have to return what the run method was supposed to do, otherwise return an empty string.
Ewerton Level 30, Belo Horizonte, Brasil
2 July 2019, 18:51
If you are stuck on the "The ReadFileThread class's run method should read lines from the file set by the setFileName method. And the getFileContents method of this same class must return the file contents. The return value is one string consisting of the lines of the file, separated by spaces." 1) Don't throw any exceptions; 2) Set your content string to "" before run.
Henrique Level 41, São Paulo, Brazil
11 June 2020, 19:30
I'm stuck exactly on this part. And I'm so stuck that I cannot even understand your hint :'(