title: NullPointerException when adding a new object to an array
body: <p>I am trying to add a Play name and length for a Theatre Seat Management Program. I want to be able to add new plays that will be on show at the theatre. Currently I have the following for class Play and its subclasses LocalPlay and ForeignPlay</p>
  
  <pre><code>public class Play {
  public String name;
  public double length;
  
  public Play(String name, double length){
      this.name = name;
      this.length = length;
  }
  
  
  public void printPlayList(){
      System.out.print("name = " + this.name);
      System.out.print("length - " + this.length);
  }   
  
  }
  
  
  class ForeignPlay extends Play{
  
  public ForeignPlay(String name, double length){
      super(name, length);
  }
  
  }
  
  class LocalPlay extends Play{
  
  public LocalPlay(String name, double length){
      super(name, length);
  }
  
  }
  </code></pre>
  
  <p>For my Admin class (the class I wish to use the addPlay function within), I am trying to add new objects to the class by passing a String and double. This is my code:</p>
  
  <pre><code>public class Admin extends User{
  
  private Play [] play;
  private int size = 0;
  
  public void addForeignPlay(String name, double length){
      this.play[size] = new ForeignPlay(name,length);
      this.size++;
  }
  
  public void addLocalPlay(String name, double length){
      this.play[size] = new LocalPlay(name,length);
      this.size++;
  }
  
  public void playDetails(){
      for(int i = 0; i &lt; this.size; i++)
      this.play[i].printPlayList();
  }
  
  public static void main (String[] args){
      Admin testAdmin = new Admin();
      testAdmin.addLocalPlay("test", 125);
      testAdmin.playDetails();
  }
  
  }
  </code></pre>
  
  <p>When attempting to run this, I would expect to have an output of 'Test' and 125.0. However, I am receiving the error message:</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.NullPointerException
        at Admin.addLocalPlay(Admin.java:18)
        at Admin.main(Admin.java:33)</p>
  </blockquote>
  
  <p>Thank you kindly for any help you can provide</p>