14.9
The
switch
 Statement
BLOCKS AND STATEMENTS
If the value is
true
, then the first contained
Statement
 (the one before the
else
 keyword) is executed; the
if
then
else
 statement completes normally
only if execution of that statement completes normally.
If the value is
false
, then the second contained
Statement
 (the one after the
else
 keyword) is executed; the
if
then
else
 statement completes normally
only if execution of that statement completes normally.
14.9   The
switch
 Statement
The
switch
 statement transfers control to one of several statements depending on
the value of an expression.
SwitchStatement:
switch (
Expression
 )
SwitchBlock
SwitchBlock:
{
S
witchBlockStatementGroups
opt
SwitchLabels
opt
 }
SwitchBlockStatementGroups:
SwitchBlockStatementGroup
SwitchBlockStatementGroups SwitchBlockStatementGroup
SwitchBlockStatementGroup:
SwitchLabels BlockStatements
SwitchLabels:
SwitchLabel
SwitchLabels SwitchLabel
SwitchLabel:
case
ConstantExpression
 :
default :
The type of the
Expression
 must be
char
,
byte
,
short
, or
int
, or a compile 
time error occurs.
The body of a
switch
 statement must be a block. Any statement immediately
contained by the block may be labeled with one or more
case
 or
default
 labels.
These labels are said to be
associated
 with the
switch
 statement, as are the values
of the constant expressions ( 15.27) in the
case
 labels.
All of the following must be true, or a compile time error will result:
274






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