Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package jpb;
- import java.io.*;
- public class SimpleIO {
- private static InputStreamReader streamIn =
- new InputStreamReader(System.in);
- private static BufferedReader in =
- new BufferedReader(streamIn, 1);
- // Displays the string s without terminating the current
- // line
- public static void prompt(String s) {
- System.out.print(s);
- System.out.flush();
- }
- // Reads and returns a single line of input entered by the
- // user; terminates the program if an exception is thrown
- public static String readLine() {
- String line = null;
- try {
- line = in.readLine();
- } catch (IOException e) {
- System.out.println("Error in SimpleIO.readLine: " +
- e.getMessage());
- System.exit(-1);
- }
- return line;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement