AP® Computer Science A glossary
Equivalent Boolean expressions
Course: AP® Computer Science A Shows up in: Unit 2: Selection and Iteration
Two Boolean expressions that evaluate to the same value in all cases. A truth table can prove they are equivalent.
Appears in the course and exam description (CED): 2.6.A.12.6.A.2
Testing a few values is not a proof: check every combination. De Morgan’s laws are a quick way to rewrite an expression into an equivalent one.
boolean a = true;
boolean b = false;
System.out.println(!(a && b) == (!a || !b));
Output:
true Learn it properly, with a checkpoint 2.6 Comparing Boolean Expressions