title: Scanning an integer and a for loop to scan some strings
body: <p>I'm trying to scan an integer and run a loop to scan strings until that integer. But this code skips the first string...</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.Scanner;
  
  public class A1 {
  
      public static void main(String[] args) {
          ArrayList &lt;String&gt; A = new ArrayList&lt;String&gt;();
          Scanner sc = new Scanner(System.in);
          System.out.println("How many strings to add:");
          int a = sc.nextInt();
          for(int i=0; i&lt;a; i++)
          {
              System.out.printf("Enter %dth string:\n", i+1);
              String s = sc.nextLine();
              A.add(s);
          }
  
          for(int i=0; i&lt;A.size(); i++)
          {
              System.out.println(A.get(i));
          }
      }
  
  }
  </code></pre>
  
  <p>Any solution?</p>