---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 26 Edition"
java_version: 26
chapter: "Chapter 14. Blocks, Statements, and Patterns"
section: "14.11"
heading: "14.11. The switch Statement"
parent: "Chapter 14. Blocks, Statements, and Patterns"
source: https://docs.oracle.com/javase/specs/jls/se26/html/jls-14.html#jls-14.11
id: "14.11"
url: https://jvm.obfuscated.software/jls/se26/14.11.html
raw: https://jvm.obfuscated.software/jls/se26/14.11.md
---

# 14.11. The `switch` Statement

The `switch` statement transfers control to one of several statements or expressions, depending on the value of an expression.

```
SwitchStatement:
  switch ( Expression ) SwitchBlock
```

The *Expression* is called the *selector expression*. The type of the selector expression must be `char`, `byte`, `short`, `int`, or a reference type, or a compile-time error occurs.

**Sections:**

- [14.11.1. Switch Blocks](14.11.1.md)
- [14.11.2. The Switch Block of a switch Statement](14.11.2.md)
- [14.11.3. Execution of a switch Statement](14.11.3.md)
