首先,我很抱歉提出这个问题,但我认为它可以使用另一个答案。德里克·舒尔茨(Derek Schultz)是对的。'\ b'字符将打印光标向后移动一个字符,使您可以覆盖在那里打印的字符(除非您在顶部打印新信息,否则它不会删除整行甚至是那里的字符)。以下是使用Java的进度条的示例,尽管它不遵循您的格式,但显示了如何解决覆盖字符的核心问题(仅在32位计算机上的Ubuntu 12.04中使用Oracle Java 7进行了测试,但它应可在所有Java系统上使用):public class BackSpaceCharacterTest{ // the exception comes from the use of accessing the main thread public static void main(String[] args) throws InterruptedException { /* Notice the user of print as opposed to println: the '\b' char cannot go over the new line char. */ System.out.print("Start[ ]"); System.out.flush(); // the flush method prints it to the screen // 11 '\b' chars: 1 for the ']', the rest are for the spaces System.out.print("\b\b\b\b\b\b\b\b\b\b\b"); System.out.flush(); Thread.sleep(500); // just to make it easy to see the changes for(int i = 0; i < 10; i++) { System.out.print("."); //overwrites a space System.out.flush(); Thread.sleep(100); } System.out.print("] Done\n"); //overwrites the ']' + adds chars System.out.flush(); }}