Learning objectives

Represent an algorithm that uses selection or repetition in words or as a flowchart, and determine the result it produces for given inputs

Write boolean expressions with ==, !=, <, >, <= and >= on primitive values, and write if, if-else, else-if and nested if statements, tracing which branch runs for given values

Combine conditions with &&, || and !, and explain how short-circuit evaluation can stop a run-time error such as a division by zero or a NullPointerException

Construct the truth table of a compound boolean expression, and use it or the De Morgan laws, together with the negation of each relational operator, to decide whether two expressions are equivalent

Simplify a conditional that contains a redundant test, and decide whether two conditional code segments give the same result for every possible input

Compare object references with == and != to detect aliases and null, and compare object contents with equals, both for String and for a class that defines its own equals method

Continue with a revision plan

These learning objectives are available to everyone. Sign in with an eligible plan to read the full note and worked examples.