Nested If Else Statement in Java

Get Into Code provides you with free C++ and Java Course in Hindi/Urdu and also provides you the opportunity to practice your skills to be perfect. In the previous video we have discussed about the Nested If Statement in Java. In this video we are going to discuss about Nested If Else Statement in Java.
Nested If Else Statement
Just like nested if Statement. If You use if else Statement in another if else statement than it will became nested if else statement. You may use as many if else statement in another if else statement as you can. We have learnt in If Else Statement that if the condition is true then the body of if keyword will be executed and if the condition is false than the body of else will be executed. In this way if condition will be false then at any point of your nested if else statement the body of else statement will be executed and the body of if keyword will be skipped whatever is written in it.
Syntax
if (condition)
 {
   \\ body of outer if 
    
    if (condition)
     {
        \\ body of nested if 
     }
    else
     {
         \\ body of nested else
     }
 }
else
 {
    \\ body of outer else
 }

Watch The Video Below to Understand Nested If Else Statement in Java


The best about our site is that we provide our readers to practice their skills because Practice Puts Brain in Your Muscles. So, Go Ahead and Write a Java Program which take three integer number as input and program will find the greater number.
Respected output will be as
First Number=24
Second Number=32
Third Number=23
Greater Number is 32

No comments

Powered by Blogger.