Skip to content
Sharp

Modern Java · interview question

Which statement about using text blocks for SQL queries is true?

Multiple choiceMediumchapter-12-curatedpremiummodern-javatext-blocks
Choose one answer
Answer and explanation

Correct answer

D. Text blocks improve readability and maintainability.

Why

Text blocks improve the readability and maintainability of SQL queries by allowing multiline strings without special escaping. However, they do not inherently prevent SQL injection or execute SQL directly.

Test yourself on Modern Java

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

Start free test
All Modern Java questions →