title: Java scan.nextLine() only waits for user input of int user input; doesn't wait for string user input
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2268598/java-programm-not-stopping-for-scan-nextline">java, programm not stopping for scan.nextLine()</a>  </p>
  </blockquote>
  
  
  
  <pre><code>    System.out.println("Welcome to the Tuition Calculator Program.");
      System.out.println("How many total credits are you taking?");
      credits = scan.nextInt();
  
      System.out.println("Are you a Washington resident? y/n");
      resident = scan.nextLine();
  
      System.out.println("Are you a graduate student? y/n");
      grad = scan.nextLine();
  </code></pre>
  
  <p>I'm new to Java and relatively new to programming. On a PC working in jGRASP. In the code above, I simply need the user to enter number of credits (the int response), residency (a string), and graduate status (string). </p>
  
  <p>It allows the user to enter credits, but then prints the resident question and the graduate question together. It doesn't stop and allow the user to enter an answer to the residency question. (It does allow me to enter my response to the graduate question.)</p>
  
  <p>Other related questions here on the forum haven't helped; I have tried adding in an extra line to swallow any extra line breaks, but that hasn't done it. Perhaps I added the wrong type of line. <a href="https://stackoverflow.com/q/2268598/1519533">This thread</a> was helpful, but didn't provide a solution that worked.</p>