title: What is the Java: NoSuchElementException error?
body: <h2>Looking for help with the following code...</h2>
  
  <pre><code>package pkgPeople;
  
  import java.io.File;
  import java.io.PrintWriter;
  import java.util.Scanner;
  
  public class CreateWithoutSerialization {
  
      public static void main(String[] args) throws Exception
      {
          BankAccount bankAccount = new BankAccount(0, 0);
          Person person = new Person();
          String nm;
          int ht;
          int wt;
          long ba;
          double bal;
          File inFile = new File("G:/CS9.27/inperson.txt");
          File outFile = new File("G:/CS9.27/outperson.txt");
          PrintWriter writer = new PrintWriter(outFile);
          Scanner reader = new Scanner(inFile);
  
          nm = reader.nextLine();
          ht = reader.nextInt();
          wt = reader.nextInt();
          ba = reader.nextLong();
          bal = reader.nextDouble();
  
          person.setName(nm);
          person.setHeight(ht);
          person.setWeight(wt);
          bankAccount.setAcctID(ba);
          bankAccount.setBalance(bal);
  
  
          System.out.println(person.toString());
  
          //Write the attributes in ASCII to a file
          writer.printf("%s is the name of the person.\r\n",nm);
          writer.printf("%d inches is the height of %s.\r\n",ht, nm);
          writer.printf("%d pounds is the weight of %s\r\n",wt,nm);
          writer.printf("%d dollars is the balance of %s\r\n", bal, nm);
          writer.printf("%l is the ID of the bank account.\r\n", ba);
  
  
  
      }
  
  }
  </code></pre>
  
  <hr>
  
  <p>Upon running, i get this exception..</p>
  
  <pre><code>Exception in thread "main" java.util.NoSuchElementException: No line found
  at java.util.Scanner.nextLine(Unknown Source)
  at pkgPeople.CreateWithoutSerialization.main(CreateWithoutSerialization.java:23)
  </code></pre>
  
  <hr>
  
  <p>Is this a file error? Have tried multiple fixes but still stuck.</p>