Makistos
10/28/2013 - 7:57 AM

An example on how to use BufferedReader to read user input from the command line. #command-line #user-input #java

An example on how to use BufferedReader to read user input from the command line. #command-line #user-input #java

private String getInput() {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String retVal = "";

        try {
            retVal = br.readLine();
        } catch (IOException ioe) {
            System.out.println("Exception occured reading your input.");
            return "";
        }
        return retVal;
    }