Jump to content
Wikibooks The Free Textbook Project

Java Programming/Keywords/while

From Wikibooks, open books for an open world
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

while is a Java keyword.

It starts a looping block.

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

while-looping-statement ::= while  condition-clause 
 single-statement | block-statement
 
condition-clause  ::= ( Boolean Expression )
single-statement  ::= Statement
block-statement  ::= { Statement [ Statements ] }

For example:

Computer code
while(i<maxLoopIter)
{
System.out.println("Iter="+i++);
}

See also:

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