ObjectStdIn
public final class StdIn
Standard input. This class provides methods for reading strings and numbers from standard input.
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 the number formatting 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.
| Method Summary | |
|---|---|
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 float |
readFloat()
Return next float from standard input |
static int |
readInt()
Return next int from standard input |
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 |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
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 void main(String[] args)