how to clear the screen by pressing a key in java code example
Example 1: how to clear the screen by pressing a key in java
Runtime.getRuntime().exec("cls");
Example 2: how to clear the screen by pressing a key in java
public static void clearScreen() {
System.out.print("\033[H\033[2J");
System.out.flush();
}