diff --git a/_projects/lessons/java/notebooks/2025-09-21-2.2.ipynb b/_projects/lessons/java/notebooks/2025-09-21-2.2.ipynb
index b6a44c7b61..51741895ad 100644
--- a/_projects/lessons/java/notebooks/2025-09-21-2.2.ipynb
+++ b/_projects/lessons/java/notebooks/2025-09-21-2.2.ipynb
@@ -2,8 +2,11 @@
"cells": [
{
"cell_type": "markdown",
- "id": "064892a5",
- "metadata": {},
+ "metadata": {
+ "vscode": {
+ "languageId": "raw"
+ }
+ },
"source": [
"---\n",
"layout: post\n",
@@ -19,13 +22,178 @@
"permalink: /csa/unit_02/2_2\n",
"---"
]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# 2.2 Boolean Expressions\n",
+ "\n",
+ "A **Boolean expression** evaluates to `true` or `false` \u2014 nothing else. The College Board puts it simply: \"An expression involving relational operators evaluates to a Boolean value\" (College Board, 2025, p. 61).\n",
+ "\n",
+ "| Operator | Meaning |\n",
+ "|---|---|\n",
+ "| `==` | equal to |\n",
+ "| `!=` | not equal to |\n",
+ "| `<` | less than |\n",
+ "| `>` | greater than |\n",
+ "| `<=` | less than or equal to |\n",
+ "| `>=` | greater than or equal to |"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "vscode": {
+ "languageId": "java"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "int score = 85;\n",
+ "\n",
+ "System.out.println(score == 85); // true\n",
+ "System.out.println(score != 100); // true\n",
+ "System.out.println(score > 90); // false\n",
+ "System.out.println(score <= 85); // true"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Raise your hand:\n",
+ "1. If `score` was 90, what would `score > 90` print?\n",
+ "2. Is `score != 85` `true` or `false` right now?"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Where else do you see this?\n",
+ "Every API you build \u2014 Spring on the CSA side, any backend on the CSP side \u2014 has to decide what to send back before it responds: *Does this exist? Is this value allowed?* Each check is a Boolean expression built from the exact operators above, and the `true`/`false` result decides the response."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "vscode": {
+ "languageId": "java"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "if (item == null) {\n",
+ " return notFound(); // equality operator: does it exist?\n",
+ "}\n",
+ "if (quantity > maxAllowed) {\n",
+ " return badRequest(); // relational operator: is it valid?\n",
+ "}"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Popcorn Hack 1\n",
+ "Predict what each line prints, then run it to check."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "vscode": {
+ "languageId": "java"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "int temp = 72;\n",
+ "System.out.println(temp >= 70);\n",
+ "System.out.println(temp == 72.0);\n",
+ "System.out.println(temp < 32);"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Popcorn Hack 2\n",
+ "Find and fix the 2 errors in this Boolean expression."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "vscode": {
+ "languageId": "java"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "int number = 4;\n",
+ "boolean isEven = number % 2 = 0;\n",
+ "System.out.println(isEven)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## AP Exam Practice\n",
+ "Try these on your own before checking the answer.\n",
+ "\n",
+ "**1.** What does `12 != 12` evaluate to?\n",
+ "A) `true` B) `false` C) `0` D) Compile-time error\n",
+ "\n",
+ "Show answer
B \u2014 != is false when both sides are equal. \n",
+ "\n",
+ "**2.**\n",
+ "```java\n",
+ "int x = 5, y = 10;\n",
+ "System.out.println(x <= y);\n",
+ "```\n",
+ "What is printed?\n",
+ "A) `5` B) `10` C) `true` D) `false`\n",
+ "\n",
+ "Show answer
C \u2014 5 is less than 10, so the relational expression evaluates to true. \n",
+ "\n",
+ "**3.** Which correctly tests two `int` values, `a` and `b`, for equality?\n",
+ "A) `a = b` B) `a == b` C) `a.equals(b)` D) `a != b`\n",
+ "\n",
+ "Show answer
B \u2014 == compares primitive values directly; a.equals(b) is for objects, not primitives. "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## References\n",
+ "- College Board. (2025). *AP Computer Science A course and exam description*. https://apcentral.collegeboard.org/media/pdf/ap-computer-science-a-course-and-exam-description.pdf\n",
+ "- Oracle. (n.d.). *Equality, relational, and conditional operators*. The Java Tutorials. https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html"
+ ]
}
],
"metadata": {
+ "kernelspec": {
+ "display_name": "Java",
+ "language": "java",
+ "name": "java"
+ },
"language_info": {
- "name": "python"
+ "codemirror_mode": "java",
+ "file_extension": ".jshell",
+ "mimetype": "text/x-java-source",
+ "name": "Java",
+ "pygments_lexer": "java",
+ "version": "17.0.12+0"
}
},
"nbformat": 4,
- "nbformat_minor": 5
+ "nbformat_minor": 2
}