Data, Technology & EngineeringExplore OptionsFocus & PrepareTake Action

Java: Switch Statements

Switch statements—which let you execute one statement from multiple conditions—are an extremely useful part of Java. However, switch changed drastically in Java 17 compared to Java 8 or 11. In this course. Instructor Maaike van Putten explains the benefits of the latest switch features. Maaike starts off with the basics of a switch statement and what you can do with it. She then introduces the syntax of the new options for switch statements and gives some use cases for them. She also explains switch expressions—what they are, how they differ from switch statements, and how to know when you use which one. Lastly, learn about pattern matching, a preview feature in Java 17 that provides more flexibility when defining conditions for switch cases.

Learn More