Skip to content
Sharp

SQL for Java Devs · interview question

Why can using a while(rs.next()) loop without closing the ResultSet become a problem in practice?

Multiple choiceHardchapter-8-curatedpremiumsql-for-java-devsresultsets-and-mapping
Choose one answer
Answer and explanation

Correct answer

B. Resource leak

Why

Not closing the ResultSet after a while(rs.next()) loop can lead to resource leaks, as the database resources remain occupied, potentially exhausting database connections.

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 →