title: Why does my scanner hasNext("string") method prompt for input?
body: <p>I realize that hasNext() is used to check if there is going to be a next input, but my hasNext prompts for an input for some reason. This is my code:</p>
  
  <pre><code>Scanner sc = new Scanner(System.in);
  
  while (!sc.hasNext("quit")) {
      System.out.println("Type anything other than quit to keep inputting. ");
      sc.nextLine();
  }
  </code></pre>
  
  <p>What my program does right off the bat is it makes me type something (before the prompt to type), and then the prompt to "type anything other than quit" pops up and the program works properly. However, I don't want that first blank input. Why does this pop up and how do I fix it? </p>