Using a Switch / Case Statement

This example shows how to use the switch / case statement.
The switch word is used to describe what variable to check values for, and the case statements are used for each possible value.

In this example we check user input (which should be a number), if the number is either 1, 2 or 3, the number is printed out.

Search for more Java info on this site here:
Custom Search

Any thoughts or questions?