Clear the the terminal screen from java program
Hello friends, Welcome to programmingscoop. Today I'm going to tell you how you can clear the terminal screen from java program at runtime.
Many times we want clear the terminal screen and placing new output on screen for example in pattern programs and animation program we use it.
Code:-
For clearing the screen you have to enter just two lines code that i mention below
- /*******clear terminal screen************/
- System.out.print("\033[H\033[2J"); //for clearing screen
- System.out.flush();
Place these code after which operation you want to clear the screen it will clear the screen.
Watch related programs to clear terminal screen by clicking here.
0 Comments