title: NullPointerExcetion Native Method Accessor... Hashing Words Issue
body: <p>I am writing a project that reads a file and sorts "Words". This code compiles correctly, yet then it gives me a null pointer exception. Any Ideas?</p>
  
  <pre><code>import java.io.File;
  import java.io.FileNotFoundException;
  import java.util.Scanner;
  import java.util.Hashtable;
  
  public class Lab {
     Hashtable&lt;String, Word&gt; words = new Hashtable&lt;String, Word&gt;();
  
     public void addWord(String s, int i) {
        if (words.containsKey(s)) {
           words.get(s).addOne();
           words.get(s).addLine(i);
        } else {
           words.put(s, new Word(s));
           words.get(s).addLine(i);
        }
     }
  
     public void main(String[] args) {
        System.out.println("HI");
        File file = new File("s.txt");
        int linecount = 1;
        try {
           Scanner scanner = new Scanner(file);
           System.out.println("HUH");
  
           while (scanner.hasNextLine()) {
              String line = scanner.nextLine();
              while (line != null) {
                 String word = scanner.next();
                 addWord(word, linecount);
              }
              linecount++;
  
           }
        } catch (FileNotFoundException e) {
           e.printStackTrace();
        }
     }
  }
  </code></pre>
  
  <p>The exception's stacktrace is:</p>
  
  <pre><code>java.lang.NullPointerException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at edu.rice.cs.drjava.model.compiler.JavacCompiler.runCommand(JavacCompiler.java:27‌​1)
  </code></pre>