How to clear the console in Java

443    Asked by anurhea in Python , Asked on Jul 23, 2021

I want to clear the console. How can I do this?

Answered by Celina Lagunas

To clear the console in java, use the given code:

 public static void clearScreen() {  
    System.out.print("");
    System.out.flush();
}

The will help you to clear the screen.



Your Answer

Interviews

Parent Categories