Most asked top Interview Questions and Answers | Online Test | Mock Test
Education platform for interview prep, online tests, tutorials, and live practice

Build skills with focused learning paths, mock tests, and interview-ready content.

WithoutBook brings subject-wise interview questions, online practice tests, tutorials, and comparison guides into one responsive learning workspace.

Search the library
Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: What is Text Blocks or Multi-line string in Java 15?
Answer:

Until now, when we wanted to define a multi-line string in Java, it usually looked like this:

String sql =
" SELECT id, title, text\n"
+ " FROM Article\n"
+ " WHERE category = \"Java\"\n"
+ "ORDER BY title";

Starting with Java 15, we can notate this string as a "text block":

String sql = """
SELECT id, title, text
FROM Article
WHERE category = "Java"
ORDER BY title""";

Save For Revision

Bookmark this item, mark it difficult, or place it in a revision set.

Open My Learning Library
Is it helpful? Yes No

Most helpful rated by users:

©2026 WithoutBook