Special offers now — see discounted courses.
day
:
hour
:
min
:
sec
See special offers
Java: Switch Statements

Java: Switch Statements

41mAdvanced2024-02-07

Authors

Maaike van Putten

Maaike van Putten

Trainer and Developer for Java, Python, Spring Boot, and More

Course details

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.

Skills covered

JavaProgramming FoundationsAdvancedOracleProgramming LanguagesSoftware Development

Concepts

0. Introduction

  • 01 - The easier way

1. Switch Statements

  • 02 - Switch statement - What and why
  • 03 - Switch syntax - Case and default
  • 04 - Switch syntax - Allowed arguments
  • 05 - Examples of real-world use cases
  • 06 - Challenge - Writing a switch statement
  • 07 - Solution - Writing a switch statement

2. Switch Expressions

  • 08 - Switch expressions - What, why, and when
  • 09 - New syntax required
  • 10 - Working with return values
  • 11 - Exhaustiveness
  • 12 - Examples of real-world use cases
  • 13 - Challenge - Writing a switch expression
  • 14 - Solution - Writing a switch expression

3. Pattern Matching (Preview Feature)

  • 15 - Pattern matching - What, why, preview
  • 16 - Pattern matching with instanceof and null
  • 17 - Guarded patterns
  • 18 - Pattern label dominance
  • 19 - Deconstruction patterns and record classes
  • 20 - Examples of real-world use cases
  • 21 - Challenge - Pattern matching for instanceof
  • 22 - Solution - Pattern matching for instanceof

Conclusion

  • 23 - Keep exploring

Related courses

Related learn paths

About us

LyndaKade is a leading learning platform that helps people learn business, software, technology, and creative skills to achieve personal and professional goals.

Phone numberAparat ChannelTelegram SupportTelegram ChannelInstagram Page

All rights to this site belong to LyndaKade.

Terms of Service|Privacy Policy

نماد الکترونیک enamad در صورت اتصال با آی‌پی داخل کشور، نمایش داده خواهد شد.
logo-samandehi - لوگو ساماندهی
zarinpal
zibal