command to clean console java code example
Example 1: java clear console
Runtime.getRuntime().exec("cls");
Example 2: java clear console
public static void clearScreen() {
System.out.print("\033[H\033[2J");
System.out.flush();
}