Java if statement

Among the decision making statements, it is the most simple one. It checks if the condition is true or not, and if it is true then it executes the block of code inside if otherwise, it will not. The block that is executed is placed within the curly braces({}).

Syntax of if statement:

Example of if statement:

Output: