How to implement a data read from the keyboard without moving the cursor to the next line console using Java?
Specifically, the command line Windows.
java.util.Scanner moves the cursor to the next line its method, just like java.io.Console.
As far as I know, return the cursor to the previous line in the Java console can not be.
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(".");
And I see:
Turn of player: 4
.
But I want to see:
Turn of player: 4.