The Java if statement is used to test the condition. It checks boolean condition: true or false. There are various types of if statement in java.
- if statement
- if-else statement
- if-else-if ladder
- nested if statement
Java IF Statement
The Java if statement tests the condition. It executes the if block if condition is true.
Syntax:
- if(condition){
- //code to be executed
- }