[ Contact ] [ Links ] [ Previous : 11 / 29 : Java Statements ] [ Up ] [ Next : 13 / 29 : Others Java Subjects ]

Control Statements

The second type of statement is the control statement.

The following list illustrates some of the control statements available in Java:

Really classical structure, especially easy to understand for english speaking programmer.
NB : BoolleanExpression are Boolean Expressions)
Break, continue, Label ...

Loop : be sure to get out of it

if (BooleanExpression) Statement
   
if (BooleanExpression) Statement else Statement
   
while (BooleanExpression) Statement
   
do Statement while (BooleanExpression)
   
for (Expression; BooleanExpression; Expression) Statement
   
break <Label>
   
continue <Label>
   
Label: Statement
   
switch (IntegerExpression)
{
	case IntegerValue:
		Statements
	default:
		Statements
}

return Expression

In these examples reserved keywords are shown in bold.


See the "Links" link above to find out the sources of the proposed informations
Pascal Vuylsteker / eScience / Computer Science / ANU
Last modified: 20/4/2004
TOC - Print
Send your comments at :
<Hugh.Fisher@anu.edu.au>