Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The if single-selection statement performs an indicated action only when the condition is true; otherwise, the action is skipped. The if...else double-selection statement allows the programmer to specify an action to perform when the condition is true and a different action when the condition is false. For example, the statement
if ( grade >= 60 ) System.out.println( "Passed" ); else System.out.println( "Failed" );