public final class StdIn extends Object
The Locale used is: language = English, country = US. This is consistent with the formatting conventions with Java floating-point literals, command-line arguments (via Double.parseDouble()) and standard output (via System.out.print()). It ensures that standard input works with the input files used in the textbook.
For additional documentation, 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 |
hasNextLine()
Does standard input have a next line?
|
static boolean |
isEmpty()
Is there only whitespace left on standard input?
|
static void |
main(String[] args)
Unit test
|
static String |
readAll()
Return rest of input from standard input
|
static boolean |
readBoolean()
Return next boolean from standard input, allowing "true" or "1" for true,
and "false" or "0" for false
|
static byte |
readByte()
Return next byte from standard input
|
static char |
readChar()
Return next char from standard input
|
static double |
readDouble()
Return next double from standard input
|
static double[] |
readDoubles()
Read rest of input as array of doubles
|
static float |
readFloat()
Return next float from standard input
|
static int |
readInt()
Return next int from standard input
|
static int[] |
readInts()
Read rest of input as array of ints
|
static String |
readLine()
Return rest of line from standard input
|
static long |
readLong()
Return next long from standard input
|
static short |
readShort()
Return next short from standard input
|
static String |
readString()
Return next string from standard input
|
static String[] |
readStrings()
Read rest of input as array of strings
|
public static boolean isEmpty()
public static String readString()
public static int readInt()
public static double readDouble()
public static float readFloat()
public static short readShort()
public static long readLong()
public static byte readByte()
public static boolean readBoolean()
public static boolean hasNextLine()
public static String readLine()
public static char readChar()
public static String readAll()
public static int[] readInts()
public static double[] readDoubles()
public static String[] readStrings()
public static void main(String[] args)