title: Returning an Object[][] gives NullPointerException
body: <p>I have an Access database which I need to retrieve all fields except the first and last and display it in a JTable. Everything works perfectly fine when I create my Object[][] but when i return it, i get a NullPointerException. I tried to find where there could be a null value in the database by printing the whole object out but that works fine and no values are null. Why would returning the Object[][] give me a NullPointerException and how can i fix it?</p>
  
  <p>the stack trace is:
  Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException</p>
  
  <pre><code>    public Object [] [] SetTrainingLogTable() throws SQLException
      {
  
      DatabaseConnection connection = new DatabaseConnection();
  
      //Retrieves all the data from the TrainingLog table
      ResultSet resultset = connection.SelectStatements("SELECT * FROM TrainingLog");
  
      //Retrieves the number of entries
      ResultSet numberofworkouts = connection.SelectStatements("SELECT COUNT(*) FROM    TrainingLog");
  
      int count = numberofworkouts.getInt(1);
      number = count;
  
      String[][] table = new String [count] [6];   
  
      //Number to incriment for while loops
      int row = 0;
  
      String date = "";
  
      while(row&lt;count)
      {
          date = resultset.getString(2);
          table [row][0] = calculate.RefineDate(date); 
          table [row][1] = resultset.getString(3);
          table [row][2] = resultset.getString(4);
          table [row][3] = resultset.getString(5);
          table [row][4] = resultset.getString(6);
          table [row][5] = resultset.getString(7);
          resultset.next();  
          row++;
      }
  
      Object[][] data = table;
  
      connection.close();
  
      return data;
  }
  </code></pre>
  
  <p>I ran a debugger and it only gives the error when the return line is run.</p>