commands in java to clear the screen

后端 未结 11 847
一向
一向 2020-11-29 07:35

What command in Java will let you clear the console in a command-line application?

11条回答
  •  渐次进展
    2020-11-29 08:22

    System.out.println("Hello!");
    

    prints the specified string and then moves the cursor to the next line.

    System.out.print("Hello!");
    

    prints the specified string and leaves the cursor immediately after that string.

    To solve the problem, identified above, of the cursor being on the second line of the console, use print instead of println.

提交回复
热议问题