Learn Java in 2018, If-ElseIf-Else Statement, Learn Java on Codecademy

Lesson Summary

In this lesson we look ata combination of conditionals that allow us to make decisions in our code. The logic behind Java's If ElseIf Else statement makes sense and helps us make our code do different things based on which expression evaluates to truth first. First the if statement is checked, if false the code within the curly braces never runs and go to the next condition, if its an "else if" then it checks that condition and if the condition is true it will run the code within the curly braces. If it is not true than it checks the next condition and repeats until it finds a true statement. If all the else ifs are false then it will run the else if there is one.

Subscribe To Monthly Newsletter. Chance to Win Monthly Prizes

* indicates required