Please see this example - http://www.javaprogrammingforums.com/java-se-api-tutorials/158-how-read-user-input-console-scanner-class.html