Java Clear Output Screen

[Solved] Java Clear Output Screen | C - Code Explorer | yomemimo.com
Question : java clear output screen

Answered by : you

public class ClearScreenExample { public static void main(String[] args) { clearScreen(); System.out.println("This is a test message."); } public static void clearScreen() { try { if (System.getProperty("os.name").contains("Windows")) { new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor(); } else { System.out.print("\033[H\033[2J"); System.out.flush(); } } catch (Exception ex) { ex.printStackTrace(); } }
}

Source : | Last Update : Tue, 19 Sep 23

Answers related to java clear output screen

Code Explorer Popular Question For C