fork download
  1. import java.util.*;
  2. import java.io.*;
  3. import java.nio.file.*;
  4. import java.lang.StringBuilder;
  5.  
  6. class FilePrep {
  7. public static void main(String args[]) {
  8. }
  9. public String getStringFromBuffer() {
  10. try {
  11. Path file = Paths.get("testfile2.txt");
  12. FileInputStream fstream = new FileInputStream("testfile2.txt");
  13. String inputLine = null;
  14. StringBuffer theText = new StringBuffer();
  15.  
  16. while((inputLine=br.readLine())!=null) {
  17. theText.append(inputLine+" ");
  18. }
  19. return theText.toString();
  20. System.out.println(theText);
  21. }
  22. catch (Exception e)
  23. {
  24. System.err.println("Error: " + e.getMessage());
  25. return null;
  26. }
  27. }
  28. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:21: error: unreachable statement
            System.out.println(theText);
            ^
Main.java:28: error: missing return statement
    }
    ^
2 errors
stdout

Standard output is empty