Suppose that you want more than one statement to be executed when a Boolean
expression evaluates to true
. You need only to combine the
multiple statements, using braces, into a single block.
In the following if
else
statement, for example, two display
statements are executed whenever the value of length
is greater than
90
:
if (length > 90) { System.out.println("It is long!"); System.out.println("It may try your patience"); }