if Statement
IfThenStatement:The Expression must have type
if (Expression)Statement IfThenElseStatement:
if (Expression)StatementNoShortIfelseStatement IfThenElseStatementNoShortIf:
if (Expression)StatementNoShortIfelseStatementNoShortIf
boolean, or a compile-time error occurs.
if (door.isOpen())
if (resident.isVisible())
resident.greet("Hello!");
else door.bell.ring();
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
while & do Statement
WhileStatement:
while (Expression)Statement WhileStatementNoShortIf:
while (Expression)StatementNoShortIf
DoStatement:
doStatementwhile (Expression) ;
while & do statement executes an Expression and a Statement repeatedly until the
value of the Expression is false.
for Statement
ForStatement:
for (ForInitopt;Expressionopt;ForUpdateopt)Statement ForStatementNoShortIf:
for (ForInitopt;Expressionopt;ForUpdateopt)StatementNoShortIf ForInit:
StatementExpressionList
LocalVariableDeclaration ForUpdate:
StatementExpressionList StatementExpressionList:
StatementExpression
StatementExpressionList,StatementExpression
for statement executes some initialization code, then executes an Expression,
a Statement, and some update code repeatedly until the value of the Expression is
false.
for ( expr1; expr2; expr3 )
statement1;
nextStatement;
Is equivalent to
expr1;
while expr2 {
statement1;
expr3; }
nextStatement;
return Statement
ReturnStatement:
returnExpressionopt;
ExpressionStatement:
StatementExpression;StatementExpression:
Assignment
PreIncrementExpression
PreDecrementExpression
PostIncrementExpression
PostDecrementExpression
MethodInvocation
ClassInstanceCreationExpression
| Previou page | Next page |