title: Scanner No Line Found Exception
body: <p>I am getting the following exception.</p>
  
  <p>java.util.NoSuchElementException: No line found</p>
  
  <p>I got this error while writing a larger program which needed to read from a text file, and so decided to do a test.</p>
  
  <pre><code>Scanner scan = new Scanner(new File("restrictions.txt");
  String s1 = scan.nextLine();
  System.out.println(s1);
  </code></pre>
  
  <p>And I still get the exception.  I have a text file in the same folder as the class called restrictions.txt which has text in it.  What am I doing wrong?</p>