rage / java-programming

https://java-programming.mooc.fi
497 stars 209 forks source link

Part 3, section 19, known bug with Netbeans System.out.print #439

Open brunojustino opened 10 months ago

brunojustino commented 10 months ago

There's a known bug in Netbeans when you use System.out.print and put a scanner after. When you run the program, it does not print the System.out.print message. Instead it wait for the user input before printing the message.

Steps:

System.out.print("Search for? ");
int searching = Integer.valueOf(scanner.nextLine());

Expected: print: "Search for? " and waits for user input. What happening: It waits for user input and after that prints: "Search for? "

Simple using System.out.println fixes the issue.