From a6860ff3aaada9d514893e2675ca16340974012c Mon Sep 17 00:00:00 2001
From: Habiba Sorour
Date: Tue, 11 Aug 2026 23:40:33 +0300
Subject: [PATCH 1/3] fixedthe error
---
source/ch3_javadatatypes.ptx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/source/ch3_javadatatypes.ptx b/source/ch3_javadatatypes.ptx
index a08b796..6c69c36 100644
--- a/source/ch3_javadatatypes.ptx
+++ b/source/ch3_javadatatypes.ptx
@@ -867,7 +867,7 @@ public class Histo {
-
+
for i in range(2, 102, 2)
@@ -904,7 +904,7 @@ public class Histo {
for (int x = 0, int y = 0; x < 10; x++, y += 2)
-
+
From 9d3d9c69a12987c01f67098894888a83e4f6073e Mon Sep 17 00:00:00 2001
From: "nshizirungudieumerci@gmail.com"
Date: Wed, 12 Aug 2026 13:43:33 -0400
Subject: [PATCH 2/3] added a parsons problem to section 8.3
---
source/ch8_filehandling.ptx | 38 +++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/source/ch8_filehandling.ptx b/source/ch8_filehandling.ptx
index 7a7cf33..d9656b0 100644
--- a/source/ch8_filehandling.ptx
+++ b/source/ch8_filehandling.ptx
@@ -287,6 +287,44 @@ public class CreateFile {
You may have noticed that there are some new methods you haven't seen yet. The hasNextLine() method checks if there is a next line in the file, and returns false if there isn't. This method allows us to iterate over every line till there is no next line. The nextLine() method of the Scanner object returns the next line in the file as a string.
+
+
+
+
+ Construct the part of a Java program that opens a file with a Scanner and
+ prints each line until there are no more lines. Drag the blocks into the correct order on the right.
+
+
+
+
+
+ try (Scanner fileReader = new Scanner(new File(filename))) {
+
+
+ try (Scanner fileReader = new Scanner(filename)) {
+
+
+
+
+
+ while (fileReader.hasNextLine()) {
+
+
+ while (fileReader.nextLine()) {
+
+
+
+
+ String data = fileReader.nextLine();
+ System.out.println(data);
+
+
+
+ }
+ }
+
+
+
From c7f4c7b65d38972f4705a1d97b1e1f7c9afb6fb9 Mon Sep 17 00:00:00 2001
From: "nshizirungudieumerci@gmail.com"
Date: Wed, 12 Aug 2026 15:37:09 -0400
Subject: [PATCH 3/3] added a select all that apply multiple choice based
question to section9.3
---
source/ch9_commonmistakes.ptx | 50 +++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/source/ch9_commonmistakes.ptx b/source/ch9_commonmistakes.ptx
index 64b59cd..4dca391 100644
--- a/source/ch9_commonmistakes.ptx
+++ b/source/ch9_commonmistakes.ptx
@@ -115,6 +115,56 @@
The 'cannot find symbol' error for the variable count on line 6 indicates that count was used before it was declared within the Histo class. In Java, all variables must be explicitly declared with a data type (e.g., int, String, ArrayList<Integer>) before they can be assigned a value or referenced in any way. The arrow in the error message points to where the undeclared variable count was first encountered. To resolve this, count needs to be declared with its appropriate type (e.g., ArrayList<Integer> count;) before any attempt to initialize or use it.
+
+
+
+ Based on , select all of the
+ statements that are true about declaring variables in Java.
+
+
+
+
+
+ Every variable must be declared with a data type before it is used.
+
+
+ Correct! Java requires a variable to be declared with its type before it can be assigned or referenced.
+
+
+
+
+ The "cannot find symbol" error happens because count was used before being declared.
+
+
+ Correct! That error means the compiler reached a variable it has no declaration for.
+
+
+
+
+ Writing ArrayList<Integer> count; before using count would fix the "cannot find symbol" error.
+
+
+ Correct! Declaring count with its type resolves the error.
+
+
+
+
+ Java lets you use a variable without declaring it first, just like Python.
+
+
+ Incorrect. Unlike Python, Java requires all variables to be declared before use.
+
+
+
+
+ The error can be fixed by adding an import statement.
+
+
+ Incorrect. The import is already present; the problem is the missing variable declaration, not a missing import.
+
+
+
+