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.  
  8. public static void main(String[] args) {
  9. // TODO Auto-generated method stub
  10. boolean sOrF = promptStringOrFile();
  11. }
  12.  
  13. public static boolean promptStringOrFile() {
  14. char cbuf[] = new char[2];
  15. do {
  16. System.out.println("Do you want to process standard (I)nput, or a (F)ile? I/F");
  17. try {
  18. br.read(cbuf, 0, 1);
  19. } catch (IOException e) {
  20. inputReadFailure(e);
  21. }
  22. } while ((!(cbuf[0]=='I' || cbuf[0]=='F')));
  23. if (cbuf[0]=='I') {
  24. return true;
  25. }
  26. else
  27. return false;
  28. }
  29. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout

Standard output is empty