Posts

Showing posts with the label nested if

Nested If in java

A nested if statement is an if-else statement with another if statement as the if body or the else body . Here conditions are evaluated from top to bottom . If  1st condition is true then the fist if statement will execute and if  1st condition is false then else if condition will check and rest of the process will move on one by one . If none of the above condition is match then else part will execute .  Syntax :           If(1st condition)           {                   // execute code           }           else if (2nd condition)           {               // execute code       ...