You have to have the break statement otherwise you “fall through” to the next case. It’s normal to have a break statement at the end of every case. The example I’ve provided is contrived to show you the functionality, but in 25 years of programming Java I can’t remember genuinely using a switch statement like this!

The default case is executed if none of the other cases are executed.

The ability to use a switch statement on String objects was introduced in Java 7.