How to set system.out.print caret at the same position?

C

Camel

Hello all,

I have a console program that prints numbers. I want the newly printed
number replace old number at the same position. How can do it?

Thank you very much in advance.
 
T

Thomas Weidenfeller

Camel said:
I have a console program that prints numbers. I want the newly printed
number replace old number at the same position. How can do it?

In general you can't. Java is not well suited for console/terminal
emulator/text applications. You can consider to use a JNI-based library
like JCurses to get more control over the console. Or you could play
with the control codes for your particular terminal emulation.

/Thomas
 
R

Real Gagnon

I have a console program that prints numbers. I want the newly printed
number replace old number at the same position. How can do it?

Try to print a "backspace" character with something like

System.out.print("\b");

Bye.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top