title: Java Scanner doesn't wait for user input
body: <p>I am using Java's Scanner to read user input. If I use nextLine only once, it works OK. With two nextLine first one doesnt wait for user to enter the string(second does).</p>
  
  <p>Output:</p>
  
  <blockquote>
    <p>X: Y: (wait for input)</p>
  </blockquote>
  
  <p>My code</p>
  
  <pre><code>System.out.print("X: ");
  x = scanner.nextLine();
  System.out.print("Y: ");
  y = scanner.nextLine();
  </code></pre>
  
  <p>Any ideas why could this happen? Thanks</p>