The code fragment
corresponds toif ((x < y) && (y < z)) System.out.println("y is between x and z"); else System.out.println("y is not between x and z");
if (x < y) if (y < z) System.out.println("y is between x and z"); else System.out.println("y is not between x and z"); else System.out.println("y is not between x and z");
In this case, by eliminating the complex condition, the code of the else-branch must be duplicated.
Note that, due to shortcut evaluation, the second condition in the && is not evaluated if the first condition is false. And this holds also for the corresponding nested if-else statements.