public static void print(int x, int y, int z) {
if (x > 10 && x / y > 10 && z > 10) {
System.out.println("Condition met");
}
System.out.println("End of program");
}
The code first prints "Condition met" and then prints "End of program"
Since the first condition is false, the if condition is false and the program skips its body.
The code only prints "End of program"
The first condition x > 10 is false, so the short-circuit evaluation prevents the execution of x / y > 10. This avoids a division by zero error. Therefore, only "End of program" is printed.
The code throws an error for division by zero
Since the first condition is false, the program doesβt bother checking the rest of conjoined conditions and it evaluates the if condition as false.