Netbeans 12 on Windows, Console not outputting System.out.print

老子叫甜甜 提交于 2021-02-08 09:51:08

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!