title: Scanner class and an Exception in thread "main" java.util.InputMismatchException error
body: <p>I have been struggling with the scanner class. I just can't seem to rap my head around it's methods. I'm trying to run set of code which seems right to me. I've tried a few tweaks but still nothing. Any hints of why i am receiving this error </p>
  
  <blockquote>
    <p>"Exception in thread "main" java.util.InputMismatchException  at
    java.util.Scanner.throwFor(Unknown Source)  at
    java.util.Scanner.next(Unknown Source)  at
    java.util.Scanner.nextInt(Unknown Source)  at
    java.util.Scanner.nextInt(Unknown Source)  at
    PolynomialTest.main(PolynomialTest.java:18)"</p>
  </blockquote>
  
  <pre><code>public class PolynomialTest {
  
  public static void main(String[] args) throws IOException {
  
  Scanner fileData = new Scanner(new File("operations.txt"));
  Polynomial math = new Polynomial();
  int coeff = fileData.nextInt();
  int expo = fileData.nextInt();
  
  while (fileData.hasNext()) {
  
      Scanner nextTerm = new Scanner(fileData.nextLine());
  
      if (nextTerm.next().equalsIgnoreCase("insert")) {
  
          math.insert(coeff, expo);
          System.out.println("The term (" + coeff + ", " + expo
                  + ") has been added to the list in its proper place");
          System.out.println("The list is now: " + math.toString());
  
      } else if (nextTerm.next().equalsIgnoreCase("delete")) {
  
          math.delete(coeff, expo);
          System.out.println("The following term has been removed ("
                  + coeff + ", " + expo + ")");
          System.out.println("The list is now: " + math.toString());
  
      } else if (nextTerm.next().equalsIgnoreCase("reverse")) {
  
          math.reverse();
          System.out
                  .println("The list was reversed in order and the list is now: "
                          + math.toString());
  
      } else if (nextTerm.next().equalsIgnoreCase("product")) {
  
          System.out.println("The product of the polynomial is: "
                  + math.product());
  
      } else {
  
          System.out.println("Not a recognized input method");
  
      }
      nextTerm.close();
  }
  PrintWriter save = new PrintWriter("operations.txt");
  save.close();
  fileData.close();
  </code></pre>
  
  <p>}</p>