在 C 语言中,我记得我可以相对于行和字符位置在命令行界面屏幕上移动不可见的插入符号,这意味着我可以让程序在屏幕上的任何位置打印任何文本。我们在Java中有这样的命令吗?
例如,这里有一个 C 中的伪代码:
int main(){
printf("launching program\n");
moveTo(4,3); //move to line 4 at character index 3 on the screen.
printf("AAA");
moveTo(3,0); //move to line 3 at character index 0 on the screen.
printf("BBB");
moveTo(2,1); //move to line 2 at character index 1 on the screen.
printf("CCC");
return 0;
}
这将在命令行界面中给出以下输出:
launching program
CCC
BBB
AAA
在这种情况下,我们是否有在 Java 中不使用任何外部或第三方库的等效方法?