Scanner - java.util.NoSuchElementException
问题 Does anyone see a problem with this? First input works fine, but after the first loop, it doesn't ask to enter a value again. How do I fix this? int value; while(true) { Scanner scan = new Scanner(System.in); System.out.println("Enter a value"); try { value = scan.nextInt(); System.out.println("value provided is: " + value); scan.nextLine(); // consumes "\n" character in buffer } catch(InputMismatchException e) // outputs error message if value provided is not an integer { System.out.println(