Skip to content
Sharp

SQL for Java Devs · interview question

Why might you choose to use a PreparedStatement in JDBC over a regular Statement?

Multiple choiceMediumchapter-8-curatedpremiumsql-for-java-devstransactions
Choose one answer
Answer and explanation

Correct answer

A. It reduces the risk of SQL injection.

Why

PreparedStatements help prevent SQL injection attacks by precompiling the SQL query and separating it from the data. This makes them safer for handling dynamic input.

Test yourself on SQL for Java Devs

A free test with instant, explained results. No account needed.

Start free test
All SQL for Java Devs questions →