Java if Statement
The condition in an if statement can be any expression that evaluates to a boolean value (true or false). This can include comparisons, such as x > y or x == y, or boolean operations, such as !flag (negation) or x && y (and). It is also possible to nest if statements, which allows you…