Skip to content
Ameen Abozaid
In reviewJNR-007-L02

Properties and YAML

  • Lesson 2 of 6
  • 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

read settings from a file.

Planned topics

  • A .properties file has key=value lines.
  • YAML uses indentation for nesting and is easy to read; spaces matter, tabs are not allowed.
  • Put the default file on the classpath (src/main/resources).
  • Read values with Properties.load (plain Java) or a framework later.
  • Give a clear error if a required value is missing.
Draft outline details

Demonstration

properties
shop.currency=EUR
shop.tax-rate=0.19
yaml
shop:
  currency: EUR
  tax-rate: 0.19

Check your understanding

What must you avoid in YAML indentation?

Show answer

Tabs; use spaces.

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.