0% found this document useful (0 votes)
5 views

Java-Basics-Control-Flow

The document outlines the basics of control flow in Java, focusing on loops and decision-making statements. It provides syntax examples for various loop types, including while, for, do..while, and for each, as well as control statements like break and continue. Additionally, it covers decision-making constructs such as if, if..else, and switch..case with their respective syntax.

Uploaded by

emmasantos2025
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Java-Basics-Control-Flow

The document outlines the basics of control flow in Java, focusing on loops and decision-making statements. It provides syntax examples for various loop types, including while, for, do..while, and for each, as well as control statements like break and continue. Additionally, it covers decision-making constructs such as if, if..else, and switch..case with their respective syntax.

Uploaded by

emmasantos2025
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Java Basics: Control Flow

Programming Fundamentals in Java


LOOPS

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;
}

You might also like