A program when you want to do something like
cls on Windows or
clear on Linux in Java.
You can clear the screen by using the escape sequence.
There is an output before clearing when scrolling.
You can also clear the screen by executing it as an external process as shown below.
In this case, scrolling has no previous output.
// Windows new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor(); // Linux new ProcessBuilder("clear").inheritIO().start().waitFor();