Skip to content
Ameen Abozaid
In reviewJNR-001-L06

Text blocks and other small wins

  • Lesson 6 of 8
  • 11 min read
  • Junior
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.
  • var for local variables when the type is obvious.
  • List.of, Map.of, and Stream.toList() give short, immutable collections.
  • Helpful NullPointerException messages tell you which variable was null.
Draft outline details

Demonstration

java
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.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.