title: Java: How to extract a Count from ResultSet Select query
body: <p>This question has been answered before here but the solutions that were posted are not working for me. Following is my code:</p>
  
  <pre><code>Statement query = this.conn.createStatement();
              ResultSet resultSet = query.executeQuery("Select COUNT(*) FROM Questions AS total");
              resultSet.next();
              int totalQuestions = resultSet.getInt("total");
              System.out.println(totalQuestions);
              System.exit(1);
              resultSet.close();
  </code></pre>
  
  <p>It just keeps on saying column total not found. I have tried it without "resultSet.next()" as well but same issue. I have also tried resultSet.getInt(1) but that doesn't work either. </p>