Java SE 8 Programmer II — Question 174
What is true about the java.sql.Statement interface?
Answer options
- A. It provides a session with the database.
- B. It is used to get an instance of a Connection object by using JDBC drivers.
- C. It provides a cursor to fetch the resulting data.
- D. It provides a class for executing SQL statements and returning the results.
Correct answer: D
Explanation
The correct answer is D because the java.sql.Statement interface is specifically designed for executing SQL statements and returning the results. Options A, B, and C are incorrect as they do not accurately represent the primary function of the Statement interface; it does not establish a session, retrieve Connection objects, or provide a cursor for data fetching.