The perfect place for easy learning...

Java Programming

×

Topics List


Java Control Statements





In java, the default execution flow of a program is a sequential order. But the sequential order of execution flow may not be suitable for all situations. Sometimes, we may want to jump from line to another line, we may want to skip a part of the program, or sometimes we may want to execute a part of the program again and again. To solve this problem, java provides control statements.

control statements in java

In java, the control statements are the statements which will tell us that in which order the instructions are getting executed. The control statements are used to control the order of execution according to our requirements. Java provides several control statements, and they are classified as follows.

Types of Control Statements

In java, the control statements are classified as follows.

  • Selection Control Statements ( Decision Making Statements )
  • Iterative Control Statements ( Looping Statements )
  • Jump Statements

Let's look at each type of control statements in java.

Selection Control Statements

In java, the selection statements are also known as decision making statements or branching statements. The selection statements are used to select a part of the program to be executed based on a condition. Java provides the following selection statements.

  • if statement
  • if-else statement
  • if-elif statement
  • nested if statement
  • switch statement

Read more about Selection Statements in java


Iterative Control Statements

In java, the iterative statements are also known as looping statements or repetitive statements. The iterative statements are used to execute a part of the program repeatedly as long as the given condition is True. Using iterative statements reduces the size of the code, reduces the code complexity, makes it more efficient, and increases the execution speed. Java provides the following iterative statements.

  • while statement
  • do-while statement
  • for statement
  • for-each statement

Read more about Iterative Statements in java


Jump Statements

In java, the jump statements are used to terminate a block or take the execution control to the next iteration. Java provides the following jump statements.

  • break
  • continue
  • return

Read more about Jump Statements in java