A final else (with no condition) runs only when every earlier condition was false. It is the catch-all, so exactly one branch of the whole chain always runs.
else
int n = -4; if (n > 0) { System.out.println("positive"); } else if (n == 0) { System.out.println("zero"); } else { System.out.println("negative"); }
n is -4: not > 0, not == 0, so the final else runs and prints negative.
negative
▶ Try it: run this, then set n to 0 and to 7 — the final else catches everything the earlier tests missed.
n
Using the sign chain above, what prints when n is 0?
Type what the sign chain prints when n is 7:
Match each value of n to what the sign chain prints.
True or false?