Java: Clear the console

后端 未结 14 2668
青春惊慌失措
青春惊慌失措 2020-11-21 23:26

Can any body please tell me what code is used for clear screen in Java? For example in C++

system(\"CLS\");

What code is used in Java for

14条回答
  •  礼貌的吻别
    2020-11-22 00:26

    A way to get this can be print multiple end of lines ("\n") and simulate the clear screen. At the end clear, at most in the unix shell, not removes the previous content, only moves it up and if you make scroll down can see the previous content.

    Here is a sample code:

    for (int i = 0; i < 50; ++i) System.out.println();
    

提交回复
热议问题