Java if-else Statement


The Java if-else statement also tests the condition. It executes the if block if condition is true otherwise else block is executed.

Syntax:

if(condition){  
   //code if condition is true  
}else{  
    //code if condition is false  
}  

Flochart