Answer the question
In order to leave comments, you need to log in
How to make standard input empty?
Hello.
There is a class
public final class StdIn {
private static Scanner scanner;
public static boolean isEmpty() { return !scanner.hasNext(); }
private static void resync() {
setScanner(new Scanner(new java.io.BufferedInputStream(System.in), CHARSET_NAME));
}
private static void setScanner(Scanner scanner) {
StdIn.scanner = scanner;
StdIn.scanner.useLocale(LOCALE);
}
StdIn.isEmpty() == true
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question