title: arraylist java compiling errors
body: <p>ok i try to play with arraylist in java awhile to experiment some thing that related my project..so i come up with a simple code like this</p>
  
  <p>having 3 file...DataStruc.java , DataStrucHand.java , testcase1.java</p>
  
  <pre><code>DataStruc.java
  
  
  public class DataStruc {
  private String testString;
  
  public DataStruc(String s){
      this.testString = s;
  }
  
  public String getTestString() {
      return testString;
  }
  
  public void setTestString(String testString) {
      this.testString = testString;
  }
  
  public String toString(){
      return String.format("%s",testString);
  }
  }
  
  
  DataStrucHand.java
  
   import java.util.ArrayList;
  
    public class DataStrucHand {
  private ArrayList&lt;DataStruc&gt; ds;
  
  public void addData(String ss){
      ds.add(new DataStruc(ss));
  }
  
  public ArrayList&lt;DataStruc&gt; getData(){
      return ds;
  }
  }
  
  
  testcase1.java
   import java.util.*; 
   public class testcase1 {
  public static void main(String args []){
      DataStrucHand dsh = new DataStrucHand();
  
      String gdata = "test";
  
      dsh.addData(gdata);
  
  
    }
     }
  </code></pre>
  
  <p>i tried to compile it and having this error</p>
  
  <pre><code> Exception in thread "main" java.lang.NullPointerException
  at DataStrucHand.addData(DataStrucHand.java:7)
  at testcase1.main(testcase1.java:8)
  </code></pre>
  
  <p>can i know what is wrong actually? i cant even add the data...i am trying to add the data and retrieve it back by creating another testcase2.java...but than i having problems in adding now to the arraylist...my purpose is to create a temp storage to keep a specific string that can be obtain by 1 program but runs with 2 different classes..</p>