14.4
Statements
BLOCKS AND STATEMENTS
The problem is that both the outer
if
 statement and the inner
if
 statement might
conceivably own the
else
 clause. In this example, one might surmise that the pro 
grammer intended the
else
 clause to belong to the outer
if
 statement. The Java
language, like C and C++ and many languages before them, arbitrarily decree that
an
else
 clause belongs to the innermost
if
 to which it might possibly belong.
This rule is captured by the following grammar:
Statement:
StatementWithoutTrailingSubstatement
LabeledStatement
IfThenStatement
IfThenElseStatement
WhileStatement
ForStatement
StatementNoShortIf:
StatementWithoutTrailingSubstatement
LabeledStatementNoShortIf
IfThenElseStatementNoShortIf
WhileStatementNoShortIf
ForStatementNoShortIf
StatementWithoutTrailingSubstatement:
Block
EmptyStatement
ExpressionStatement
SwitchStatement
DoStatement
BreakStatement
ContinueStatement
ReturnStatement
SynchronizedStatement
ThrowStatement
TryStatement
The following are repeated from  14.8 to make the presentation here clearer:
IfThenStatement:
if (
Expression
 )
Statement
IfThenElseStatement:
if (
Expression
 )
StatementNoShortIf
 else
Statement
IfThenElseStatementNoShortIf:
if (
Expression
 )
StatementNoShortIf
 else
StatementNoShortIf
270






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved