IF ELSE IF STATEMENT with JAVA CODE

Introduction :-

Hello Friends , how are you all once again I welcome to all of you in my website Technology Inspire ( If else if statement ) .

Today in this article I will give complete Information about if else if statement . Till now we only talked about if statement and if else statement , but today we will tell you all in this article . what is the function of if else if statement ?

If you want to know about if statement then by clicking on the link below you will directly reach that page.

if statement

if else statement

In this article we will talk about the if else if statement , so without delay let’s get started.

If else if statement :-

The if else if statement also works exactly like the if else statement . The only difference between these two is the if else statement gives output only on two conditions true or false . But this is not the case at all in the if else if statement . In the if else if statement , you can take the output by applying more than two conditions.

If else if statement is mostly used to create & Design Time table , build application or more many software related in condition.

Example :-

Suppose you have to go to the GYM and you have to do different workouts every day if the week , then only by the name of the day which workout you have to do on that day . To know this , it can be easily known only with the help of if else if statement.

Next , we will understand this example easily with the help of a great programming .

Condition :::

Flow diagram of if else if statement

As it is clearly visible in this flow diagram that if else if statement is use in it by applying more than two conditions . with it help , we get the output we want .

Practical :-

class Timetable{
     public static void main(String [] args){
           String Day;
               Day = "Monday";
       // for checking what is my workout today .
      // use if condition 1
           if(Day=="Monday") {
                      System.out.println("Today is my chest workout");
                            }
         else if(Day=="Tuesday") {
                      System.out.println("Today is my Biceup workout");
                             }
         else if(Day=="Wednesday") {
                      System.out.println("Today is my Back workout");
                             }
         else if(Day=="Thrusday") {
                      System.out.println("Today is my Tricup workout");
                             }
         else if(Day=="Friday") {
                      System.out.println("Today is my Shoulder workout");
                             }
         else if(Day=="Saturday") {
                      System.out.println("Today is my Legs workout");
                             }
         else if(Day=="Sunday") {
                      System.out.println("Today is my Rest day");
                             }
         else {
                      System.out.println("Today is not a Day");
                             }
               }
                      }

OUTPUT :-

Today is my chest workout

YouTube help :-

If there is anything in this article that you have not understood, then with the help of my YouTube channel (Technology Inspire ) you will understand easily . click on the YouTube video below (if else if statement ).

If you found anything helpful in this video or article , then do like , share and Subscribe my youTube channel and this page (if else statement ) .

NOTE :-

I hope that in today’s article you all know well what is if else if statement and how is work ?

Thank you all for reading this article till the end . If any one of you feel that some changes are need in this article or if you all want an article on some other topic , then definitely tell in the comment box so that very soon I will give another update on that article or that doubt . I can clear (if else if statement ) .

So that’s all for today , with another new update in next article , good bye till then!

All of you also follow on my YouTube channel.

Related post

JAVA PROGRAMMING

INSTALLATION OF JDK

IF STATEMENT

if else statement

Leave a Comment

Your email address will not be published.