Hello,
For many years, and both with NetBeans and with just a terminal, I have used
methods like this, to prompt the user to enter (say) an integer:
public static int inkeyInteger( String message ){
System.out.print( message );
Scanner console = new Scanner(System.in);
return console.nextInt();
}
Now in NetBeans 12, this code fails - the message is not printed until after
the user supplies data to the Scanner.
I have tried all the possible orderings of these 3 lines of code, and passing
the Scanner, etc. etc. I have searched StackOverflow.
It can be worked around if I print the message before calling a method
containing the scanner definition and next() call. This will require changing
hundreds of method calls throughout a large program.
Is there a workaround or patch etc.?
Chris Lanz
Department of Computer Science
340 Dunn Hall, SUNY Potsdam
[email protected]
315 267 2407
315 268 1547
Nature and nature's laws lay hid in night:
God said, Let Newton be! and all was light. (Pope)
It did not last: the Devil howling "Ho!
Let Einstein be!" restored the status quo. (Squire)