How to implement data reading from the keyboard without moving the console cursor to the next line using Java? Specifically in the Windows command line.
java.util.Scanner moves the cursor to the next line in its own way, just like java.io.Console .
As far as I know, it's impossible to return the cursor to the previous console line in Java.
public static String Read() { Scanner Sc = new Scanner(System.in); return Sc.next(); } System.out.print("Turn of player: "); TempPlayerGuess = Integer.parseInt(Read()); System.out.print("."); The console issues:
Turn of player: 4
.
But I would like to see:
Turn of player: 4.