public class ConsoleInput
extends java.lang.Object
ints, doubles and Strings from the console.
No exceptions are thrown.| Constructor and Description |
|---|
ConsoleInput()
Open the input connection.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the input connection.
|
double |
readDouble(java.lang.String prompt)
Read a
double. |
int |
readInt(java.lang.String prompt)
Read an
int. |
java.lang.String |
readString(java.lang.String prompt)
Read a
String. |
public void close()
public java.lang.String readString(java.lang.String prompt)
String. The user will be prompted until a non-empty String is enterred.prompt - The user prompt.public int readInt(java.lang.String prompt)
int. The user will be prompted until a valid int is enterred.prompt - The user prompt.public double readDouble(java.lang.String prompt)
double. The user will be prompted until a valid double is enterred.prompt - The user prompt.