March 2019
Intermediate to advanced
242 pages
6h 21m
English
In this chapter, you saw how switch expressions have enhanced the traditional switch statement. You can use switch expressions to return a value that can be used to initialize variables or reassign values to them. It also makes your code less verbose. By removing default fall through of the control across switch branches, you are less likely to introduce logical errors with switch expressions.
In the next chapter, we'll cover multiple improvements and additions in JDK 12.
Read now
Unlock full access