Skip to content

Control Statements In Java

Gopi Gorantala
Gopi Gorantala
1 min read

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:

  1. Decision-making statements
    1. if-then
    2. if-then-else
    3. switch
  2. Looping statements
    1. for
    2. while
    3. do-while
  3. Branching/Jump statements
    1. break
    2. continue
    3. return

Learn more about the control statements and how to use them in the next lessons.

Learn Java

Gopi Gorantala Twitter

Gopi is a software engineer with over 14 years of experience. He specializes in Java-based technology stack and has worked for various startups, the European government, and technology giants.

Comments