Input a line from System.in without doing a CR/LF
Just joined up. Hello everyone.
I'm using Java for the first time, and I've been trying to figure this one out for hours and it's bugging me. Can anyone help?
I want to get some input from System.in, but when I press 'Enter' I don't want to do a CR/LF - I want the response from my program to be printed on the same line that I was typing on, not the next line.
For example, if the input that I type in is "3 4 + .", and the response from the computer is "7 ok", then I want the "7 ok" to be printed after my input, and only then go on to the next line, like this:
3 4 + . 7 ok
val @ . 66 ok
So, the newline is only started after the 'ok', not when I hit 'Enter'.
I've tried java.util.Scanner and something along the lines of
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Many thanks if anyone can help.