1/49
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Boolean expression
An expression that evaluates to either true or false; used as the condition in if statements and loops.
Selection
Program control that chooses between different paths of execution (e.g., using if/else).
Iteration
Repeating a block of code, typically using loops such as while or for.
Relational operator
An operator that compares ordering (e.g.,
Equality operator
An operator that checks “same vs different” (== or !=) and produces a boolean result.
Logical AND (&&)
Combines two boolean expressions; true only when both parts are true.
Logical OR (||)
Combines two boolean expressions; true when at least one part is true.
Logical NOT (!)
Negates a boolean expression; !true becomes false and !false becomes true.
Operator precedence
Rules Java uses to decide how to group operations in an expression (notably: ! before relational before equality before && before ||).
Parentheses (grouping)
Used to make the intended order of evaluation explicit and reduce mistakes when reading/writing conditions.
Assignment vs comparison (= vs ==)
= assigns a value to a variable, while == compares two values for equality; confusing them is a common condition bug.
Primitive type comparison with ==
For primitives (int, double, char, boolean), == compares the actual stored values.
Object reference comparison (==)
For objects (like String), == checks whether two references point to the same object in memory, not whether contents match.
String content equality (.equals)
Method used to compare Strings by their characters/contents (AP CSA standard for String equality).
NullPointerException (NPE)
A crash that occurs when you call a method (like .equals) on a null reference.
Safe equals pattern ("literal".equals(var))
Calling .equals on a string literal (e.g., "yes".equals(s)) avoids NPE even if the variable is null.
Lexicographic order
Alphabetical-style ordering used for Strings when comparing which comes before/after another.
String.compareTo
A String method that returns a negative number, 0, or a positive number depending on lexicographic ordering relative to another string.
compareTo sign check (
Correct way to interpret compareTo in conditions: test whether the result is less than 0, equal to 0, or greater than 0 (not just -1/0/1).
Range check (inclusive)
A compound condition that checks a value is between bounds, e.g., x >= a && x <= b.
Out-of-range check
A compound condition that checks a value is outside bounds, e.g., x < a || x > b.
Compound boolean expression
A condition built by combining simpler boolean expressions with logical operators like && and ||.
Short-circuit evaluation
Java evaluates && and || left to right and may stop early (false && … stops; true || … stops).
Protective condition ordering
Placing a safety check first (e.g., s != null) so short-circuiting prevents unsafe evaluation (e.g., s.equals(…)).
De Morgan’s laws
Rules for negating compound conditions: !(p && q) ≡ (!p || !q) and !(p || q) ≡ (!p && !q).
if statement
A selection structure that runs its block only when the condition is true; otherwise the block is skipped.
Guard condition
A check used to prevent invalid actions (e.g., checking before dividing by zero or before unsafe operations).
if-else statement
A two-branch structure where exactly one of the two blocks runs (either the if block or the else block).
else-if chain
A multi-branch structure that tests conditions in order; the first true condition runs and the rest are skipped.
Condition ordering (specific to general)
Design principle for else-if chains: order checks so earlier, broader conditions don’t “steal” cases from later ones.
Nested if statement
An if statement placed inside another if/else; useful when one decision depends on a prior decision.
Dangling else
Java rule that an else matches the closest preceding unmatched if, which can cause surprises if braces are omitted.
Braces { } best practice
Using braces around if/else blocks improves readability and prevents else-from-attaching-to-the-wrong-if errors.
while loop
A condition-controlled loop that repeats while a boolean condition is true; best when repetition count isn’t known ahead of time.
Pre-test loop
A loop (like while) that checks its condition before running the body, so it may execute zero times.
Control variable
A variable whose value affects whether a loop continues (must be updated correctly to avoid infinite loops).
Infinite loop
A loop that never ends because its condition never becomes false (often due to missing/incorrect control variable updates).
Off-by-one error
A boundary mistake where a loop runs one too many or one too few times due to incorrect start/stop conditions.
Sentinel value
A special value (e.g., -1) that signals “stop” in a loop.
Sentinel-controlled loop
A loop pattern that continues until a sentinel value is encountered; requires updating the sentinel-related variable inside the loop.
Loop invariant
An idea for tracing/debugging: a statement that remains true each time the loop condition is checked, helping you stay oriented.
for loop
A count-controlled loop that bundles initialization, condition, and update; best when the number of iterations is known or expressible.
for loop header (init; condition; update)
The three-part structure of a for loop: run initialization once, test condition before each iteration, then apply update after the body.
for-to-while equivalence
A for loop can be rewritten as a while loop by moving initialization before the loop and the update to the end of the loop body.
Loop variable scope
A variable declared in a for header (e.g., int i = 0) exists only within the loop (header and body), not after it ends.
Nested loop
A loop inside another loop, used to repeat a repeated process (common in tracing and pattern problems).
Outer loop vs inner loop execution
In nested loops, the inner loop runs start-to-finish for each single iteration of the outer loop; total executions often multiply.
Pattern printing with nested loops
Using an outer loop for rows and an inner loop for columns to build repeated text patterns (e.g., rectangles of *).
System.out.print vs System.out.println
print outputs without a newline; println outputs and then ends the line—this changes traced output formatting.
break statement
A Java statement that immediately exits the nearest loop; AP CSA emphasizes understanding loop conditions rather than relying heavily on break.