public final class StdIn extends java.lang.Object
In
class, which applies to this class as well.
See Section 1.5 of "Introduction to Programming in Java: An Interdisciplinary Approach" by Robert Sedgewick and Kevin Wayne.
Modifier and Type | Method and Description |
---|---|
static boolean |
hasNextChar()
Is the input empty (not even whitespace)?
Use this to know whether the next call to
readChar()
will succeed. |
static boolean |
hasNextLine()
Does the input have a next line?
Use this to know whether the next call to
readLine()
will succeed. |
static boolean |
isEmpty()
Is the input empty (except possibly for whitespace)?
(A whitespace is a space, or a tab, or a newline, etc.)
Use this to know whether the next call to
readString() , readDouble() , etc will succeed. |
static void |
main(java.lang.String[] args)
Interactive test of basic functionality.
|
static java.lang.String |
readAll()
Read and return the remainder of the input as a string.
|
static double[] |
readAllDoubles()
Read all doubles until the end of input is reached,
and return them.
|
static int[] |
readAllInts()
Read all ints until the end of input is reached,
and return them.
|
static java.lang.String[] |
readAllStrings()
Read all strings until the end of input is reached,
and return them.
|
static boolean |
readBoolean()
Read and return the next boolean, allowing case-insensitive
"true" or "1" for true, and "false" or "0" for false.
|
static byte |
readByte()
Lê e devolve o próximo byte.
|
static char |
readChar()
Read and return the next character.
|
static double |
readDouble()
Lê e devolve o próximo double.
|
static double[] |
readDoubles()
Deprecated.
For more consistency, use
readAllDoubles() |
static float |
readFloat()
Lê e devolve o próximo float.
|
static int |
readInt()
Read and return the next int.
|
static int[] |
readInts()
DEPRECATED: For more consistency, use readAllInts().
|
static java.lang.String |
readLine()
Read and return the next line.
|
static long |
readLong()
Lê e devolve o próximo long.
|
static short |
readShort()
Lê e devolve o próximo short.
|
static java.lang.String |
readString()
Read and return the next string.
|
static java.lang.String[] |
readStrings()
Deprecated.
For more consistency, use
readAllStrings() |
public static boolean isEmpty()
readString()
, readDouble()
, etc will succeed.public static boolean hasNextLine()
readLine()
will succeed.
Functionally equivalent to hasNextChar()
.public static boolean hasNextChar()
readChar()
will succeed.
Functionally equivalent to hasNextLine()
.public static java.lang.String readLine()
public static char readChar()
public static java.lang.String readAll()
public static java.lang.String readString()
public static int readInt()
public static double readDouble()
public static float readFloat()
public static long readLong()
public static short readShort()
public static byte readByte()
public static boolean readBoolean()
public static java.lang.String[] readAllStrings()
public static int[] readAllInts()
public static double[] readAllDoubles()
public static int[] readInts()
public static double[] readDoubles()
readAllDoubles()
public static java.lang.String[] readStrings()
readAllStrings()
public static void main(java.lang.String[] args)