Nested if with Example in Java || Lesson 18 || Java Programming || Learning Monkey ||

Publié le: 10 mai 2023
sur la chaîne: Learning Monkey
122
2

Nested if with Example in Java
In this class, We discuss Nested if with Example in Java.
The reader should have prior knowledge of if elseif else statements. Click Here.
The "If" statement is written inside the "If" statement. We call it nested if.
With an example, we understand it better.
Example:
if(condition)
{
if(condition)
{
}
else
{
}
}
else
{
if(condition)
{
}
else
{
}
}
In the above example, the condition of the first if statement is true. Then the "if" statement inside is executed.
Below example helps the reader to understand the situation where a nested if statement helps.
Example:
Write a program to divide students into batches based on the below table conditions.
Student marks for five subjects will be provided.
1) Maths
2) English
3) Physics
4) Social
5) Chemistry
Total marks gt 400 and maths gt 90 he belongs to Bathch A.
Total marks gt 400 and maths lt 90 he belongs to Bathch B.
Total marks gt= 400 and maths gt 90. He belongs to Batch C.
Total marks lt= 400 and maths lt 90 he belongs to Bathch A.
The below diagram shows the complete code.
The first two conditions are the same total marks greater than 400.
The second conditions are different in the first two lines in the table.
So we go with the nested if condition here.
Code:
Link for playlists:
   / @learningmonkey  


Link for our website: https://learningmonkey.in

Follow us on Facebook @   / learningmonkey  

Follow us on Instagram @   / learningmonkey1  

Follow us on Twitter @   / _learningmonkey  

Mail us @ learningmonkey01@gmail.com


Sur cette page du site, vous pouvez voir la vidéo en ligne Nested if with Example in Java || Lesson 18 || Java Programming || Learning Monkey || durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Learning Monkey 10 mai 2023, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 122 fois et il a aimé 2 téléspectateurs. Bon visionnage!