Eclipse:如何让光标出现在控制台的最新位置?

Eclipse: How can I get the cursor to appear at the latest point in the console?

我正在使用 Eclipse 运行 下面的 Java 程序。程序等待读取第二行时,为什么光标出现在行首"Your first string is: "?如何设置光标始终出现在控制台的最新位置?

public class Test {

    public static void main(String[] args) throws IOException {
        System.out.println("Enter first string: ");

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String enteredText = br.readLine();

        System.out.println("Your first string is: " + enteredText);

        System.out.println("Enter second string: ");
        enteredText = br.readLine();

        System.out.println("Your second string is: " + enteredText);
    }
}

标准的 Eclipse 控制台存在各种问题。您可以尝试使用外部控制台。它的配置已经在这个答案

中得到了很好的描述

在这种情况下,运行 直接在 shell 中编程可能更简单。您可以使用 'javac' 命令编译和 'java' 到 运行 像这样:

javac Test.java
java Test