Skip to content

Glossary: Java Basics

Switch expression

Also written: switch, case, default

A `switch` that produces a value, with each `case` giving a result after `->` and `default` covering everything else. It ends with a semicolon.

Where the book teaches it

Related terms

Ternary operator