Java provides selection statements that allow the program to choose between alternative actions during execution. The choice is based on criteria specified in the selection statement. These selection statements are
simple if Statement
The simple if statement has the following syntax:
if (<conditional expression>) <statement>
It is used to decide whether an action is to be performed or not, based on a condition. The condition is specified by <conditional expression> and the action to be performed is specified by <statement>.
The semantics of the simple if statement are straightforward. The <conditional expression> is evaluated first. If its value is true, then ...