title: Java: BufferedReader and NullPointerException
body: <p>My code works as supposed, the a problem arises when I type in this <code>if</code> statement: </p>
  
  <pre><code>if (sList.get(i).equals(null)){break;}
  </code></pre>
  
  <p>the program crashes with the following debug information (NullPointerException):</p>
  
  <blockquote>
    <p>java.lang.NullPointerException
        at HangmanLexicon.(HangmanLexicon.java:51)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at sun.applet.AppletPanel.createApplet(AppletPanel.java:807)
        at sun.applet.AppletPanel.runLoader(AppletPanel.java:714)
        at sun.applet.AppletPanel.run(AppletPanel.java:368)
        at java.lang.Thread.run(Thread.java:680)</p>
  </blockquote>
  
  <p>Here is all the code (yeah I know it´s messy, it looks that way when learning new stuff):</p>
  
  <pre><code>public HangmanLexicon() 
  {
  /* 1. Open the data file HangmanLexicon.txt using a 
   * BufferedReader that will allow you to read it line by line. */
  String readWord = "";
  
  
   try
   {
   BufferedReader rd = new BufferedReader (new FileReader ("ShorterLexicon.txt"));
  
      while (true)
      {
          readWord = rd.readLine();
          println(readWord);
          sList.add(readWord);
          if (readWord == null){
              println("Shit has hit the fan.");
              break;}
      }
      rd.close();
   }
   catch (IOException ex)
   {
       println ("Shit has hit the fan.");
       throw new ErrorException(ex);
   }
  
   println("readWord: "+ readWord);
  /* 2. Read the lines from the file into an ArrayList. */
   for (int i = 0; i &lt; sList.size(); i++)
      {
          if (sList.get(i).equals (null)){println("done.");}
          println("get: "+sList.get(i) + " pos: " + i);
      }
  
  }
  </code></pre>