title: Confused with Java Objects
body: <p>I am a beginner with Java, and I am trying the following code:</p>
  
  <pre><code>public class MovieTestDrive {
  
      public static void main(String[] args) {
          Movie one = new Movie();
          one.title = "Gone with the Stock";
          one.playIt();
          System.out.println(one.title);   // Works!! one.title is equal to Dora
  
          Movie [] arr = new Movie[2];
          arr[0].playIt();
          System.out.println(arr[0].title); //Error: Null Pointer Exception
  
      }
  }
  
  
  class Movie {
  
          String title;
  
          void playIt() {
               title = "Dora";
          }
  
   }
  </code></pre>
  
  <p>Why does the code works in the assignment of a primitive variable while it doesn't when using an array?</p>