Control Statements In Java
Table of Contents
Introduction
When you write code or a program, the program executes the blocks in the order they appear from top to bottom. Control flow statements help break up this execution flow by providing decision-making, looping, and branching capabilities. They allow your program to execute specific code blocks conditionally.
In other terms, control statements direct the flow of execution in a program.
Control statements aid decision-making, looping through code blocks and controlling the execution sequence.
Using control statements, developers can create programs that make decisions and perform different operations based on inputs and conditions.
Types
There are 3 types of control statements:
- Decision-making statements
if-then
if-then-else
switch
- Looping statements
for
while
do-while
- Branching/Jump statements
break
continue
return
Learn more about the control statements and how to use them in the next lessons.
Gopi Gorantala Newsletter
Join the newsletter to receive the latest updates in your inbox.