Chapter 5. Controlling the flow

Controlling the flow

5.1 Properties of a good program

5.2 Conditional loops with while- and do-statements

5.3 User-defined exceptions

5.4 The type char

5.5 The switch-statement

5.6 Case Study 2: Rock–scissors–paper game

Properties of a good program

The structure of a program indicates how its parts are connected together, and how sound those connections are. One can think of the structure of a bridge: each strut and rivet plays its role, and the whole performs a defined function efficiently. Bridges can even look pleasing. So it is with programs. When we create them we aim to achieve a structure that in the first instance achieves the required ...

Get Java Gently, Third 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.