Java Programming/Keywords/else

else is a Java keyword. It is an optional part of a branching statement. It starts the 'false' statement block.

The general syntax of a if, using Extended Backus-Naur Form, is

branching-statement ::= if condition-clause 
                                    single-statement | block-statement
                       [ else 
                                    single-statement | block-statement ]
 
condition-clause    ::= ( Boolean Expression )
single-statement    ::= Statement
block-statement     ::= { Statement [ Statement ] }

For example:

Computer code
if ( expression ) {
   System.out.println("'True' statement block");
} else {
   System.out.println("'False' statement block");
}


See also: