title: Why does hasNextLine() never end?
body: <p>Sorry if this sounds too simple. I'm very new to Java.</p>
  
  <p>Here is some simple code I was using to examine <code>hasNextLine()</code>. When I run it, I can't make it stop. I thought if you didn't write any input and pressed <kbd>Enter</kbd>, you would escape the <code>while</code> loop.</p>
  
  <p>Can someone explain to me how <code>hasNextLine()</code> works in this situation?</p>
  
  <pre><code>import java.util.*;
  
  public class StringRaw {
  
      public static void main(String[] args) {
          Scanner sc = new Scanner(System.in);
          while (sc.hasNextLine()) {
              String str = sc.nextLine();
          }
          System.out.print("YOU'VE GOT THROUGH");
      }
  }
  </code></pre>