title: Prompt user in command prompt
body: <p>I'm currently working on a program that takes information form google sheets and runs calculations. I use "gradle -q run" to run my program and I want it to prompt the user inside the terminal. Right now I am using scanner but it says "Enter your name: Exception in thread "main" java.util.NoSuchElementException" when I run instead of waiting for me to add a input, How do I fix this?</p>
  
  <pre><code>public static void main(String[] args) throws IOException {
          // Build a new authorized API client service.
          Sheets service = getSheetsService();
  
          // Prints the names and majors of students in a sample spreadsheet:
          // https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit
          String spreadsheetId = "1Pfs-EpysJZXibe1pHiPLEx8cOCC86H5he5ouApejqiE";
          String range = "Sheet1!A:E";
  
       // create a scanner so we can read the command-line input
          Scanner scanner = new Scanner(System.in);
  
          //  prompt for the user's name
          System.out.print("Enter your name: ");
  
          // get their input as a String
          String username = scanner.nextLine();
  
          // prompt for their age
          System.out.print("Enter your age: ");
  
          // get the age as an int
          int age = scanner.nextInt();
  
          System.out.println(String.format("%s, your age is %d", username, age));
  
  
          ValueRange response = service.spreadsheets().values()
              .get(spreadsheetId, range)
              .execute();
          List&lt;List&lt;Object&gt;&gt; values = response.getValues();
          if (values == null || values.size() == 0) {
              System.out.println("No data found.");
          } else {
            System.out.println("Dominik's Awesome Script Says:");
            System.out.println("");
            for (List row : values) {
              // Print columns A and E, which correspond to indices 0 and 4.
              System.out.printf("%s, %s\n", row.get(0), row.get(4));
            }
          }
      }
  </code></pre>