title: Null pointer Exception while Setting data to the TableView in JavaFX?
body: <p>When I am setting data to the <code>ObservableList</code> it throwing null pointer exception, I could not understand the problem. anyone please help me to find the solution.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>@FXML
  private Label label;
  @FXML
  private ObservableList&lt;ObservableList&gt; data;
  @FXML
  private TableColumn column1;
  @FXML
  private TableColumn column2;
  @FXML
  private TableView table;
  
  public void initialize(URL url, ResourceBundle rb) {
      // TODO
      String selectSql = "select first_name,last_name from hr.employees";
      try (Connection conn = ConnectDB.getConnection(); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(selectSql)) {
          System.out.println("Getting Connection....");
          while (rs.next()) {
              ObservableList&lt;String&gt; temp = FXCollections.observableArrayList();
              temp.add(rs.getString(1));
              System.out.println("First Name == "+rs.getString(1));
              System.out.println("Last Name == "+rs.getString(2));
              temp.add(rs.getString(2));
              System.out.println("List Value === "+temp);
              data.add(temp);
              //table.setItems(temp);
          }
          table.setItems(data);
      } catch (Exception e) {
          //System.out.println("Error: "+e.getMessage());
          Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, e);
      }
  }
  </code></pre>
  
  <p>i am getting error in --->  data.add(temp);</p>