wiley_pastebin

bufferedreader 1

Mar 15th, 2019
2,939
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1. import java.io.*;
  2. public class InputDemo {
  3.  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  4.  
  5.  private void demoInput() {
  6.   System.out.println("Insert some text: ");
  7.   String userin;
  8.   try {
  9.    userin = br.readLine();
  10.   } catch (IOException e) {
  11.   System.out.println("Something went wrong!");
  12.   return;
  13.  }
  14.  
  15.  System.out.println("You said: " + userin);
  16.  
  17.  } 
  18.  //...
  19. }
Advertisement
Add Comment
Please, Sign In to add comment