68 758
Assignments Done
Successfully Done
In January 2019

Answer to Question #63005 in Java | JSP | JSF for jonney

Question #63005
explain exactly what "rs.next()" do in addition to its return value.
Expert's answer
When you get the result set, it cursor is under the first line. So to get the data you need first to move cursor to the first line. rs.next() shifts the cursor to the next row of the result set from the database and returns true if there is any row, otherwise returns false. It can you in a while loop like this:
if (rs.next()) {
You can also use additional method hasNext(), that return true is there is a next row.
if(rs.hasNext()) {
// do something

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions