Java Code Example: if else statement on boolean expressions

Logical operators have different priorities and therefore are executed at different times.

The order is as follows:
Logical complements (!) are executed first,
logical conjunctions (&&) are executed next,
and logical disjunctions (||) are executed at the end.

public class BooleanExpressions {
    public static void main(String[] args) {
        boolean a = true, b = false, c = true;

        if ((a || b) && c) {
            System.out.print("True");
        } else {
            System.out.print("False");
        }
    }
}
Output
True