I want to know how to manage the print format in the console. My problem is that I have 2 threads, one of them constantly prints information on the console, and the other constantly asks the user to write information, but during recording, if the other thread prints something, it shortens the phrase that the user writes and breaks it. How do you control it?
My theme code 1:
while (exit == false) {
scanner = new Scanner(System.in);
message = scanner.nextLine();
}
My theme code 2:
while (receive.getExecutingState()) {
srvMsg = receive.Receive();
System.out.println(srvMsg);
}
Console output:
No more data to show.
No more data to show.
hNo more data to show.
eNo more data to show.
llo
I want him to continue to print messages when the user was writing data, but not sharing them.
Thanks in advance!
Edit: As @Thomas said that I want more clearly, I need to save the text that the user writes at the bottom of the console, and the rest is updated.