O
O
Ostic2020-05-26 20:03:57
Java
Ostic, 2020-05-26 20:03:57

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);
    }

what do you need to type in the console to get ?
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 question

Ask a Question

731 491 924 answers to any question