public final class StdIn extends Object
See the technical information in the documentation of the In
class, which applies to this class as well.
| Modifier and Type | Method and Description |
|---|---|
static boolean |
hasNextChar()
Is the input empty (including 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)? Use this
to know whether the next call to
readString(),
readDouble(), etc will succeed. |
static void |
main(String[] args)
Interactive test of basic functionality.
|
static 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 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()
Read and return the next byte.
|
static char |
readChar()
Read and return the next character.
|
static double |
readDouble()
Read and return the next double.
|
static double[] |
readDoubles()
Deprecated.
For more consistency, use
readAllDoubles() |
static float |
readFloat()
Read and return the next float.
|
static int |
readInt()
Read and return the next int.
|
static int[] |
readInts()
Deprecated.
For more consistency, use
readAllInts() |
static String |
readLine()
Read and return the next line.
|
static long |
readLong()
Read and return the next long.
|
static short |
readShort()
Read and return the next short.
|
static String |
readString()
Read and return the next string.
|
static 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 String readLine()
public static char readChar()
public static String readAll()
public static 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 String[] readAllStrings()
public static int[] readAllInts()
public static double[] readAllDoubles()
public static int[] readInts()
readAllInts()public static double[] readDoubles()
readAllDoubles()public static String[] readStrings()
readAllStrings()public static void main(String[] args)
Copyright © 2015. All Rights Reserved.