14.11.2
Example of
do
 statement
BLOCKS AND STATEMENTS
14.11.2   Example of
do
 statement
The following code is one possible implementation of the
toHexString
 method
( 20.7.14) of class
Integer
:
public static String toHexString(int i) {
StringBuffer buf = new StringBuffer(8);
do {
buf.append(Character.forDigit(i & 0xF, 16));
i >>>= 4;
} while (i != 0);
return buf.reverse().toString();
}
Because at least one digit must be generated, the
do
 statement is an appropriate
control structure.
14.12   The
for
 Statement
The
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
.
ForStatement:
for (
ForInit
opt
 ;
Expression
opt
 ;
ForUpdate
opt
 )
Statement
ForStatementNoShortIf:
for (
ForInit
opt
 ;
Expression
opt
 ;
ForUpdate
opt
 )
StatementNoShortIf
ForInit:
StatementExpressionList
LocalVariableDeclaration
ForUpdate:
StatementExpressionList
StatementExpressionList:
StatementExpression
StatementExpressionList
 ,
StatementExpression
The
Expression
 must have type
boolean
, or a compile time error occurs.
280






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