The switch statement can have a number of possible execution paths and I find it very useful when doing android programming. The following code example, WeekDay, declares an integer named week whose value represents a week day. The code displays the name of the week day, based on the value of the week day number (int), using the switch statement.
Android Example: The switch statement is used to determine which option menu item was selected by the user. The corresponding Activity is then started.