Jump to content
Wikibooks The Free Textbook Project

Java Programming/Keywords/else

From Wikibooks, open books for an open world

This is the current revision of this page, as edited by Strange quark (discuss | contribs) at 18:26, 4 July 2017 (Fix categorization). The present address (URL) is a permanent link to this version.

Revision as of 18:26, 4 July 2017 by Strange quark (discuss | contribs) (Fix categorization)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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:

AltStyle によって変換されたページ (->オリジナル) /