APCSA 2A STUDY GUIDE
Boolean Expression - Answer -A boolean expression evaluates to either true or false
using relational operators to compare values.
Relational Operator: == - Answer -Checks if two values are equal.
Relational Operator: != - Answer -Checks if two values are not equal.
Relational Operator: > - Answer -Checks if the left value is greater than the right.
Relational Operator: < - Answer -Checks if the left value is less than the right.
Relational Operator: >= - Answer -Checks if the left value is greater than or equal to the
right.
Relational Operator: <= - Answer -Checks if the left value is less than or equal to the
right.
Logical Operator: && (AND) - Answer -Returns true only if both sides are true.
Logical Operator: || (OR) - Answer -Returns true if at least one side is true.
Logical Operator: ! (NOT) - Answer -Reverses the truth value of a condition.
if / else / else if Structure - Answer -Conditions are checked from top to bottom; the first
match executes, and others are skipped.
Multiple if vs. Nested if Statements - Answer -Separate if statements run independently;
nested if statements depend on prior conditions.
Nested if Statements - Key Points - Answer -Use when one condition depends on
another. Each else matches the closest unmatched if. Indentation shows structure.
Arithmetic Conditions and % Operator - Answer -% (modulus) returns the remainder.
Useful for checking even/odd, multiples, or randomized conditions.
Variable Updates Inside if Blocks - Answer -Changes to variables inside if blocks affect
later code and should be tracked carefully.
Nested Logic with Boolean Variables - Answer -Complex conditions can combine
multiple boolean expressions using logical operators.
Comparing Strings in Java - Answer -Use .equals() or .compareTo() instead of == to
compare string values.
Boolean Expression - Answer -A boolean expression evaluates to either true or false
using relational operators to compare values.
Relational Operator: == - Answer -Checks if two values are equal.
Relational Operator: != - Answer -Checks if two values are not equal.
Relational Operator: > - Answer -Checks if the left value is greater than the right.
Relational Operator: < - Answer -Checks if the left value is less than the right.
Relational Operator: >= - Answer -Checks if the left value is greater than or equal to the
right.
Relational Operator: <= - Answer -Checks if the left value is less than or equal to the
right.
Logical Operator: && (AND) - Answer -Returns true only if both sides are true.
Logical Operator: || (OR) - Answer -Returns true if at least one side is true.
Logical Operator: ! (NOT) - Answer -Reverses the truth value of a condition.
if / else / else if Structure - Answer -Conditions are checked from top to bottom; the first
match executes, and others are skipped.
Multiple if vs. Nested if Statements - Answer -Separate if statements run independently;
nested if statements depend on prior conditions.
Nested if Statements - Key Points - Answer -Use when one condition depends on
another. Each else matches the closest unmatched if. Indentation shows structure.
Arithmetic Conditions and % Operator - Answer -% (modulus) returns the remainder.
Useful for checking even/odd, multiples, or randomized conditions.
Variable Updates Inside if Blocks - Answer -Changes to variables inside if blocks affect
later code and should be tracked carefully.
Nested Logic with Boolean Variables - Answer -Complex conditions can combine
multiple boolean expressions using logical operators.
Comparing Strings in Java - Answer -Use .equals() or .compareTo() instead of == to
compare string values.