fork download
  1. import java.io.BufferedReader;
  2. import java.io.File;
  3. import java.io.IOException;
  4. import java.io.InputStreamReader;
  5.  
  6. public class main {
  7. public static void main(String[] args) {
  8. if (promptStringOrFile()) {
  9. /*
  10. //These functions are actually called, but all I want to figure out is promptStringOrFile() for now...
  11. String config[] = grabConfig();
  12. String input=readInput();
  13. Counter counter=new Counter(config);
  14. WordFrequency frequency=counter.process(input);
  15. frequency.output();
  16. */
  17. }
  18. }
  19.  
  20. public static boolean promptStringOrFile() {
  21. char cbuf[] = new char[2];
  22. do {
  23. System.out.println("Do you want to process standard (I)nput, or a (F)ile? I/F");
  24. try {
  25. br.read(cbuf, 0, 1);
  26. } catch (IOException e) {
  27. inputReadFailure(e);
  28. }
  29. } while ((!(cbuf[0]=='I' || cbuf[0]=='F')));
  30. if (cbuf[0]=='I') {
  31. return true;
  32. }
  33. else
  34. return false;
  35. }
  36. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout

Standard output is empty