switch Statement UML Activity Diagram

Figure 5.10 shows the UML activity diagram for the general switch statement. Most switch statements use a break in each case to terminate the switch statement after processing the case. Figure 5.10 emphasizes this by including break statements in the activity diagram. The diagram makes it clear that the break statement at the end of a case causes control to exit the switch statement immediately.

Image

Fig. 5.10 | switch multiple-selection statement UML activity diagram with break statements.

The break statement is not required for the switch’s last case (or the optional default case, when it appears last), because ...

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.