Java OCA OCP Practice Question 2530

Question

Which of the following position a ResultSet cursor to a location immediately before the first row? (Choose all that apply.)

  • A. rs.absolute(-1)
  • B. rs.absolute(0)
  • C. rs.absolute(1)
  • D. rs.beforeFirst()
  • E. rs.first()
  • F. rs.next()


B, D.

Note

On a scrollable ResultSet, the absolute() method positions the cursor.

-1 means the last row.

1 means the first row.

0 means before the first row.

Therefore, choice B is correct.

There is also a method beforeFirst() that is equivalent, making choice D correct as well.




PreviousNext

Related