title: NullPointerException when filling a 2Dimensional array with a vector
body: <p>I have a bit of a problem that I cant seem to make work. Im trying to fill an array with a vector in a for loop(as the size of the vector will change over time).
  I create my vector like this in a class called <strong>StudentFactory</strong>:</p>
  
  <pre><code>private Vector&lt;StudentImpl&gt; theListOfStudents = new Vector&lt;StudentImpl&gt;();
  </code></pre>
  
  <p>and pass it to a class called <strong>table</strong> like this:</p>
  
  <pre><code>public Vector&lt;StudentImpl&gt; table() {
          return theListOfStudents;
      }
  </code></pre>
  
  <p>and then in the <strong>table</strong> class i try and fill the 2D array like this:</p>
  
  <pre><code>        theFactory  = StudentFactory.getInstance();
  
          // Create columns names
          String columnNames[] = { "Name", "Address"};
          Vector&lt;StudentImpl&gt; temp;
          temp = theFactory.table();
          // Create some data
          String [][] data;
          for(int i = 0; i &lt; temp.size(); i++) 
          {
                 data[i][0] = temp.get(i).getTheName();
                 data[i][1] = temp.get(i).getTheAddress();
          }
  
  
          // Create a new table instance
          table = new JTable(data, columnNames);
  </code></pre>
  
  <p>It keeps telling me to set the <code>String [][] data;</code> to null but when i do i get the null reference pointer. Any help here would be great thanks</p>