Java if-else Statement
The if-else statement is an extension of the if statement that allows you to specify two different code blocks to be executed depending on the result of the condition. The else clause is optional, so it is possible to use an if statement without an else clause. It is also possible to nest if-else statements,…