After a query is executed, the ResultSet object traverses the results by using the next() method.
This method can traverse the result set and detect whether the end of the result set is reached.
During the traversal, you can use the getXXX method of the ResultSet object to extract data from the result set, where XXX corresponds to a Java data type.
Example: Traverse the ResultSet object rs to retrieve and print the name of each customer.
while (rs.next()) {
System.out.println(rs.getString(1));
}
When the end of the result set is reached, the next() method returns false. Customer names are converted to Java string values.