title: Reading a double from a text file in java
body: <p>Can someone please explain to me why I get the error 'InputMismatchException' on the the line where I try to read in a double? Thanks!</p>
  
  <pre><code>        int num=inFile.nextInt();
          for(int i=0;i&lt;num;i++){
              String inName=inFile.next();
              double inPrice=inFile.nextDouble();           // &lt;&lt;&lt;this line
              Book bookInFile = new Book(inName, inPrice);
              books.add(bookInFile);
          }
  </code></pre>
  
  <p>Data in the text file:</p>
  
  <pre><code>4
  War and Peace
  12.99
  Green Eggs and Ham
  3.99
  Harry Potter
  5.99
  james
  5.0
  </code></pre>