Kar*_*arl 2 java command-line caret command-line-interface
在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;
}
Run Code Online (Sandbox Code Playgroud)
这将在命令行界面中提供以下输出:
launching program
CCC
BBB
AAA
Run Code Online (Sandbox Code Playgroud)
在这种情况下,我们是否在Java中使用等效方法而不使用任何外部或第三方库?
| 归档时间: |
|
| 查看次数: |
4190 次 |
| 最近记录: |