|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IOModel
The IOModel
interface defines the input and output methods
supported by both the IOConsole
and IODialog
classes.
Method Summary | |
---|---|
void |
print(boolean x)
Makes sure that print can display a boolean . |
void |
print(char x)
Makes sure that print can display a char . |
void |
print(double x)
Makes sure that print can display a double . |
void |
print(float x)
Makes sure that print can display a float . |
void |
print(int x)
Makes sure that print can display an int . |
void |
print(long x)
Makes sure that print can display a long . |
void |
print(Object x)
Makes sure that print can display an Object . |
void |
print(String value)
Displays the argument value, allowing for the possibility of more output on the same line. |
void |
println()
Completes the output line. |
void |
println(boolean x)
Makes sure that println can display a boolean . |
void |
println(char x)
Makes sure that println can display a char . |
void |
println(double x)
Makes sure that println can display a double . |
void |
println(float x)
Makes sure that println can display a float . |
void |
println(int x)
Makes sure that println can display an int . |
void |
println(long x)
Makes sure that println can display a long . |
void |
println(Object x)
Makes sure that println can display an Object . |
void |
println(String value)
Displays the value and then completes the line. |
boolean |
readBoolean()
Reads and returns a boolean value from the user, which must match either true or false , ignoring case. |
boolean |
readBoolean(String prompt)
Prompts the user to enter a boolean value, which is then returned as the value of this method. |
boolean |
readBoolean(String prompt,
String trueLabel,
String falseLabel)
Prompts the user to enter a value, which is interpreted as a boolean value by matching it against the trueLabel and falseLabel
parameters. |
double |
readDouble()
Reads and returns a double-precision value from the user. |
double |
readDouble(double low,
double high)
Reads and returns a double-precision value from the user, which is constrained to be within the specified inclusive range. |
double |
readDouble(String prompt)
Prompts the user to enter an double-precision number, which is then returned as the value of this method. |
double |
readDouble(String prompt,
double low,
double high)
Prompts the user to enter an double-precision number, which is then returned as the value of this method. |
int |
readInt()
Reads and returns an integer value from the user. |
int |
readInt(int low,
int high)
Reads and returns an integer value from the user, which is constrained to be within the specified inclusive range. |
int |
readInt(String prompt)
Prompts the user to enter an integer, which is then returned as the value of this method. |
int |
readInt(String prompt,
int low,
int high)
Prompts the user to enter an integer, which is then returned as the value of this method. |
String |
readLine()
Reads and returns a line of input, without including the end-of-line characters that terminate the input. |
String |
readLine(String prompt)
Prompts the user to enter a line of text, which is then returned as the value of this method. |
void |
showErrorMessage(String msg)
Displays the error message. |
Method Detail |
---|
void print(boolean x)
print
can display a boolean
.
void print(char x)
print
can display a char
.
void print(double x)
print
can display a double
.
void print(float x)
print
can display a float
.
void print(int x)
print
can display an int
.
void print(long x)
print
can display a long
.
void print(Object x)
print
can display an Object
.
void print(String value)
print
method is overloaded
so that value
can be of any type.
value
- The value to be displayedvoid println()
void println(boolean x)
println
can display a boolean
.
void println(char x)
println
can display a char
.
void println(double x)
println
can display a double
.
void println(float x)
println
can display a float
.
void println(int x)
println
can display an int
.
void println(long x)
println
can display a long
.
void println(Object x)
println
can display an Object
.
void println(String value)
println
method is overloaded so that value
can be of any type.
value
- The value to be displayedboolean readBoolean()
true
or false
, ignoring case.
boolean readBoolean(String prompt)
prompt
- The prompt string to display to the user
boolean readBoolean(String prompt, String trueLabel, String falseLabel)
trueLabel
and falseLabel
parameters.
prompt
- The prompt string to display to the usertrueLabel
- The string used to indicate true
falseLabel
- The string used to indicate false
double readDouble()
double
double readDouble(double low, double high)
low
- The lowest value in the permitted rangehigh
- The highest value in the permitted range
double
double readDouble(String prompt)
prompt
- The prompt string to display to the user
double
double readDouble(String prompt, double low, double high)
low
and high
.
prompt
- The prompt string to display to the userlow
- The lowest value in the permitted rangehigh
- The highest value in the permitted range
double
int readInt()
int readInt(int low, int high)
low
- The lowest value in the permitted rangehigh
- The highest value in the permitted range
int readInt(String prompt)
prompt
- The prompt string to display to the user
int readInt(String prompt, int low, int high)
low
and high
.
prompt
- The prompt string to display to the userlow
- The lowest value in the permitted rangehigh
- The highest value in the permitted range
String readLine()
String
String readLine(String prompt)
prompt
- The prompt string to display to the user
String
void showErrorMessage(String msg)
msg
- The error msg to be displayed
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |