问题
Running the following simple program in Netbeans 12 and finding that the print statements won't display until after all data is entered - so there is no prompting before the input request. When using println, it works as expected.
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Enter first name: ");
String firstName = in.next();
System.out.print("Enter last name: ");
String lastName = in.next();
System.out.print("Enter age: ");
int age = in.nextInt();
System.out.printf("%-16s%-16s%-16s%n", "First Name", "Last Name", "Age");
System.out.printf("%-16s%-16s%-16s%n", firstName, lastName, age);
来源:https://stackoverflow.com/questions/63687672/netbeans-12-on-windows-console-not-outputting-system-out-print