Java-Basics-Control-Flow
Java-Basics-Control-Flow
LOOP SYNTAX
while while(<condition>){
<statements>;
}
for For(<initialization>;<condition>;<update>
){
<statements>;
}
do..while Do{
}while(<condition>);
LOOPS
LOOP SYNTAX
for each For(<declaration> : <arraylist>){
<statements>;
}
LOOP CONTROL STATEMENTS
STATEMENT DESCRIPTION
break Terminates the loop or switch statement
and transfers execution to the statement
immediately following the loop or switch
continue Causes the loop to skip the remainder of its
body and immediately retest its condition
prior to reiterating.
DECISION MAKINGS
STATEMENT SYNTAX
if if(<boolean_expression>){
<statements>;
}
if..else if(<boolean_expression>){
<statements>;
}
else{ //if false
<statements>;
}
DECISION MAKINGS
STATEMENT SYNTAX
if if(<boolean_expression>){
<statements>;
}
if..else if(<boolean_expression>){
<statements>;
}
else{ //if false
<statements>;
}
DECISION MAKINGS
STATEMENT SYNTAX
switch..case switch(<expression>){
case <value1>:
statement;
break;
case <value2>:
statement;
break;
default:
statement;
break;
}