Java Arena

Module 57 Extra

switch, var and text blocks

An extra module, not part of the MOOC. The switch statement and its fall-through, switch expressions with arrows and yield, switch on strings and enums (and how javac checks that every constant is covered), var for local variables, and text blocks with String.format and printf for lining up columns.

Steps

  1. The switch statement
  2. switch expressions and arrows
  3. switch on strings and enums
  4. var for local variables
  5. Text blocks and formatted text