In C, I recalled that I can move the invisible caret around the command line interface screen with respect to the line and character position, meaning I can make the program print any text anywhere on the screen. Do we have such command in Java?
For instance, here is a pseudocode in 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;
}
This will give the following output in the command line interface:
launching program
CCC
BBB
AAA
Do we have an equivalent method in Java without using any external or third party library in this case?
JCurses (Java port of ncurses library from C) is one possibility
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With