The if statement allows your program to fulfill an operator or group of operators depending on the conditions, based on the value of the boolean variable or expression. The if statement is the main selection operator in Java and allows you to selectively change the course of program execution - and this is one of the main differences between programming and simple calculation.