The if-else Structure

Learn how an if-else structure works in Java.

We'll cover the following...

What is an if-else statement?

Think about the term if-else in real life. Here is a common phrase:

Java offers a two-way selection process. There are two sets of statements: one to be executed when the boolean condition is true, and another set for when the boolean condition is false.

Explanation

In this case, the body of the if is executed ...