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

Veröffentlicht am: 10 Mai 2023
auf dem Kanal: 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


Auf dieser Seite können Sie das Online-Video Nested if with Example in Java || Lesson 18 || Java Programming || Learning Monkey || mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Learning Monkey 10 Mai 2023 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 122 Mal angesehen und es wurde von 2 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!