Specifications

Sun Services
Java™ Programming Language
Module 4, slide 19 of 31
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Complex if, else Statements
The if-else statement syntax:
if (
<boolean_expression>
)
<statement_or_block>
else
<statement_or_block>
Example:
if ( x < 10 ) {
System.out.println("Are you finished yet?");
} else {
System.out.println("Keep working...");
}