if…else Statement

An if proclamation can be trailed by a non-compulsory else explanation, which executes when the Boolean outflow is false. The syntax for this construct is as follows:

if(<condition>){
//Executes if condition is true
}
else{
//Executes if condition is false
}

Sample Implementation:

public class myTest {
  public static void main(string args[]) {
    int i = 0;
    if (i > 1) {
      System.out.print(“The
        if construct is executing!”);
    } else {
      System.out.print(“The
        else construct is executing!”);
    }
  }
}

This would create the accompanying result:

The else construct is executing!