Text blocks and other small wins
On This Lesson 4 topics
The content for this lesson is written and waiting for review. The outline below shows what it covers. It will be published once it is approved.
In this lesson
write multi-line text clearly and use other small features.
Planned topics
- A text block starts and ends with three quotes.
- It keeps line breaks and removes common indentation. Good for JSON and SQL.
varfor local variables when the type is obvious.List.of,Map.of, andStream.toList()give short, immutable collections.- Helpful
NullPointerExceptionmessages tell you which variable was null.
Draft outline details
Demonstration
String json = """
{"sku": "A-1", "price": 1999}
""";Check your understanding
What are text blocks best for?
Show answer
Multi-line text such as JSON, SQL, or HTML.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.