Answers for "clear the console java"

3

java clear console

// in JDK 11 you can do:

// It can be better than exec("cls") because it even works in intellij.
// Also, putting println() in a for loop is worse because there is a
// noticable delay between calls. This code does a single call, but
// stacks a ton of '\n's.

private void clearConsole() {
	System.out.println(System.lineSeparator().repeat(100));
}
Posted by: Guest on June-21-2021
1

java clear console

public static void clearScreen() {
        System.out.print("\033[H\033[2J");
        System.out.flush();
    }
Posted by: Guest on April-30-2021
2

java clear console

Runtime.getRuntime().exec("cls");
Posted by: Guest on June-23-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language