Advertisement
Guest User

GameHelper

a guest
Oct 28th, 2011
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1. package game;
  2. import java.io.*;
  3. public class GameHelper {
  4.  
  5.     public String getUserInput(String prompt) {
  6.         String inputLine = null;
  7.         System.out.print(prompt + "  ");
  8.         try {
  9.             BufferedReader is = new BufferedReader(new InputStreamReader(
  10.                     System.in));
  11.             inputLine = is.readLine();
  12.             if (inputLine.length() == 0)
  13.                 return null;
  14.         } catch (IOException e) {
  15.             System.out.println("IOException: " + e);
  16.         }
  17.         return inputLine.toLowerCase();
  18.     }
  19.  
  20.    
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement