com.wordesign.util
Class ConsoleReader

java.lang.Object
  |
  +--com.wordesign.util.ConsoleReader

public class ConsoleReader
extends java.lang.Object

Title: First Course In Java: examples and HomeWorks Description: This class is a utility class to read input from the Command Line Copyright: Copyright (c) 2001


Constructor Summary
ConsoleReader()
           
 
Method Summary
static void main(java.lang.String[] args)
          This is a simple test method.
static double readDouble()
          This method reads a double value from the command line, it returns only once a correct double has been entered, if the user enters text that cannot be parsed as a double, this method will inform the user and ask for the data again.
static int readInt()
          This method reads an integer from the command line, it returns only once a correct integer has been entered, if the user enters text that cannot be parsed as an integer, this method will inform the user and ask for the data again.
static java.lang.String readLine()
          This method reads a line of text from the command line, it waits until a line of text is entered (the user has to press return) and then returns
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsoleReader

public ConsoleReader()
Method Detail

readInt

public static int readInt()
This method reads an integer from the command line, it returns only once a correct integer has been entered, if the user enters text that cannot be parsed as an integer, this method will inform the user and ask for the data again.
Returns:
returns an int that represents the value entered by the user

readDouble

public static double readDouble()
This method reads a double value from the command line, it returns only once a correct double has been entered, if the user enters text that cannot be parsed as a double, this method will inform the user and ask for the data again.
Returns:
returns a double that represents the value entered by the user

readLine

public static java.lang.String readLine()
This method reads a line of text from the command line, it waits until a line of text is entered (the user has to press return) and then returns
Returns:
returns the line the user entered, this method does not return a null value, but might return an empty string ("").

main

public static void main(java.lang.String[] args)
This is a simple test method.