程序没有接受用户的输入
Program is not taking input from user
这是 java 程序,我正在尝试让用户输入姓名,但程序只打印“输入学生姓名”这一行,没有 cin
System.out.println("\n\t\tAdd at least 5 members to Start the Game");
System.out.println("\n\t\tEnter Name Of Student = ");
String name=input.nextLine();
您需要像
一样使用扫描仪
System.out.println("\n\t\tAdd at least 5 members to Start the Game");
System.out.println("\n\t\tEnter Name Of Student = ");
Scanner scanner = new Scanner(System.in);
String studentName = scanner.nextLine();
有关更多详细信息和其他选项,请参阅此 link
这是 java 程序,我正在尝试让用户输入姓名,但程序只打印“输入学生姓名”这一行,没有 cin
System.out.println("\n\t\tAdd at least 5 members to Start the Game");
System.out.println("\n\t\tEnter Name Of Student = ");
String name=input.nextLine();
您需要像
一样使用扫描仪System.out.println("\n\t\tAdd at least 5 members to Start the Game");
System.out.println("\n\t\tEnter Name Of Student = ");
Scanner scanner = new Scanner(System.in);
String studentName = scanner.nextLine();
有关更多详细信息和其他选项,请参阅此 link