title: Java: Null Pointer Exception using replaceAll
body: <p>Apologies for bothering you all with this relatively simple question, but I keep on running into a null pointer exception when calling replaceAll("\.","") and I was wondering why...Undoubtedly it's something simple that I'm just not getting.  </p>
  
  <p>Brief Summary of IPAddress:
  The first class mentioned will be passed a String value from IPAddressTester (mentioned afterwards) which will be stored in class IPAddress as ipString.  The string itself will be of form ###.###.###.##.  My eventual goal will be to strip away the periods of this string, combine the resulting tokens, and convert to an integer for later manipulation (see hashCode method).  Obviously this class is incomplete and it might very well have other problems/issues, but I am currently focusing merely on the null pointer error resulting from replaceAll.</p>
  
  <p>Brief Summary of IPAddressTest:
  Exactly as its name implies, this tests IPAddress.  Basically a "driver". </p>
  
  <pre><code>package ipResolver;
  
  import java.util.Arrays;
  import java.util.StringTokenizer; 
  import java.util.Scanner;
  
  public class IPAddress implements Comparable&lt;IPAddress&gt;{
  
       private String ipString;
  
       private int ipInt;
       private int ipHash;
  
  
       //Constructor
       public IPAddress(String ip){
           ipString = ip;
       }
  
  
       //--------------------------------Begin Error Region
       String tmpString = ipString.replaceAll("\\.","");
       //--------------------------------End Error Region        
  
       public int hashCode(int ipToBeHashed){
           return ipHash;
       }
  
       public boolean equals(Object o){
           return ipString.equals(String.valueOf(o));
       }
  
       public int compareTo(IPAddress IP){
           return ipInt - IP.ipInt;
       }
  
       public String toString()
       {
           return ipString;
       }
  
       public void gettmpString(){
           System.out.println(tmpString);
       }
  }
  </code></pre>
  
  <p>IPAddressTest Class</p>
  
  <pre><code>package test_code;
  import java.util.Arrays;
  
  import ipResolver.IPAddress;
  
  public class IPAddressTest {
      public static void main(String args[]){
          String testString = "130.191.208.70";
          IPAddress ipAdd = new IPAddress(testString);
          System.out.println(ipAdd);
  
          ipAdd.gettmpString();
  
      }
  }
  </code></pre>
  
  <p>Again, my sincere apologies for bothering you all with this, but I'm guessing this question will probably have a simple one or two sentence answer (which will hopefully not <em>ahem</em> be too insulting ;-)).</p>