Java Programming

Decision Making & Branching Statements In Java

Sometimes while writing any program, we need to make some conditions because a program consists of a set of statements and we need to test any certain condition. For example, suppose a case when we want to compare two numbers that which number is greater and which number is smaller.

In this post, we will talk about the decision making statements which we generally used in our program to test certain condition or conditions.

decision making statement in java

Decision Making Statements

Decision-making statements are the statements in Java which are used to test the various conditions in our program.

In simple words, testing condition means to check whether the given condition is true or false. If the condition becomes true then our next statement execute otherwise it will not.

There are basically 3 methods available in Java to test the conditions,

  1. If statement
  2. Switch Statement
  3. Conditional Operator Statement

If statement

-> Simple if statement

-> If…else statement

-> Nested if…else statement

-> If…else ladder statement

Switch Statement

-> Simple Switch Statement

Conditional Operator Statement

-> Conditional Statement

Leave a Reply

Your email address will not be published.