Skip to content
Sharp

Modern Java · interview question

What is one advantage of using text blocks over traditional string concatenation for JSON data?

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

Correct answer

D. Improved readability and maintainability.

Why

Text blocks improve the readability and maintainability of JSON data in Java code by eliminating the need for escape sequences and concatenation. This leads to cleaner, more understandable code.

Test yourself on Modern Java

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

Start free test
All Modern Java questions →