ResultSet result = stat.executeQuery(
"SELECT COUNT(*) FROM Customer WHERE State = 'HI'");
result.next();
int count = result.getInt(1);
Note that the following alternative is significantly slower if there are many such
customers.
ResultSet result = stat.executeQuery(
"SELECT * FROM Customer WHERE State = 'HI'");
while (result.next()) count++; // Inefficient