title: How to use a For loop to get user input in Java?
body: <p>My entire code is posted below. My issue can be seen in this output:</p>
  
  <pre><code>Enter the character representation of your first configuration: p
  How many symbols are under this configuration? 3
  Enter the first symbol: Enter the first symbol: 1
  Enter the first symbol: None
  [, 1, None]
  </code></pre>
  
  <p>As you can see, the first iteration of the for loop is executed without getting user input. It appears as if it has been skipped.  </p>
  
  <p>My question is this: <strong>How do I create a For loop that will ask for user input for each iteration of the loop?</strong> Not skip an iteration as my code is doing now. I've looked all over the internet for the answer, but I can't find anything specifically. </p>
  
  <pre><code>import java.util.Scanner;
  import java.util.ArrayList;
  
  class read {
      public static void main(String[] args) {
  
          // Create instance of class
          Tape instructions = new Tape();
  
  
          // Assign scanner to keyboard variable
          Scanner keyboard = new Scanner(System.in);
  
  
          // Get user input for mConfig and convert to char
          System.out.print("Enter the character representation of your first configuration: ");
          String userMConfig = keyboard.nextLine();
          char c = userMConfig.charAt(0);
  
  
          // Get number of symbols/operations/f-configurations
          System.out.print("How many symbols are under this configuration? ");
          int numOfSymbols = keyboard.nextInt();
  
  
          // Define array of symbols
          ArrayList&lt;String&gt; userSymbols = new ArrayList&lt;String&gt;();
  
          for (int i = 1; i&lt;= numOfSymbols; i++)
          {
              System.out.println("Enter the first symbol: ");
              String userInputSymbol = keyboard.nextLine();
              userSymbols.add(userInputSymbol);
  
          }
  
  
  
          // Assign values to object methods
          instructions.mConfig(c);
          instructions.symbols(userSymbols);
  
  
  
          // Testing code
          System.out.println(instructions.getSymbols());
  
  
  
  
  
      }
  }
  </code></pre>
  
  <p>Here is just my For loop:</p>
  
  <pre><code>for (int i = 1; i&lt;= numOfSymbols; i++)
              {
                  System.out.println("Enter the first symbol: ");
                  String userInputSymbol = keyboard.nextLine();
                  userSymbols.add(userInputSymbol);
  
              }
  </code></pre>