What is wrong with the short circuit logic in this Java code?
Why doesn't func3 get executed in the program below? After func1, func2 doesn't need to get evaluated but for func3, shouldn't it? if (func1() || func2() && func3()) { System.out.println("true"); } else { System.out.println("false"); } } public static boolean func1() { System.out.println("func1"); return true; } public static boolean func2() { System.out.println("func2"); return false; } public static boolean func3() { System.out.println("func3"); return false; } You're using a short-circuited or. If the first argument is true, the entire expression is true. It might help if I add the implicit