-5

Just like we have the clear screen in C/C++... Is there a way to do the same in Java? I've looked everywhere and found nothing at all.

I am trying to use it to update what a program shows every second, getting rid of all the code that appeared before. If you know of any other way to do this, I would really appreciate it

Thanks :)

braX
  • 11,506
  • 5
  • 20
  • 33
Tom
  • 45
  • 3

1 Answers1

0

Below is the code sample which works in command prompt

import java.io.*;
public class ClearDemo
{
 public static void main(String args[])throws IOException,InterruptedException
 {
  System.out.println("Hello ,this is test program");
 new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
 }
}
Swanand Keskar
  • 1,023
  • 1
  • 13
  • 27