diff --git a/source/ch7_recursion.ptx b/source/ch7_recursion.ptx index 5f1da65..f04f71c 100644 --- a/source/ch7_recursion.ptx +++ b/source/ch7_recursion.ptx @@ -238,6 +238,7 @@ def main(): main() +

separation of concerns The key insight here is called the separation of concerns. The public sum_array method provides a user-friendly interface—callers just pass an array and get the sum. Users don't need to know about indexes or how the recursion works internally. The private _sum_helper method handles the recursive logic with the extra parameter needed to track progress through the array. diff --git a/source/ch8_filehandling.ptx b/source/ch8_filehandling.ptx index ba5d0cf..542ebfb 100644 --- a/source/ch8_filehandling.ptx +++ b/source/ch8_filehandling.ptx @@ -73,10 +73,10 @@

- We will now create a File object. It is important to create a meaningful name for the File object. We will call ours myFile, and we will call our class CreateFileObject. + We will now create a File object. It is important to create a meaningful name for the File object. We will call ours myFile, and we will call our class CreateFileObject. shows the code to create a File object in Java.

- - + + import java.io.File; @@ -90,6 +90,7 @@ public class CreateFile { } +

@@ -103,10 +104,10 @@ public class CreateFile {

- First, lets look at the equivalent Python code: + shows the equivalent code to create a file in Python.

- - + + filename = "newfile.txt" print("Attempting to write to '" + filename + "' using 'w' mode...") @@ -120,12 +121,13 @@ public class CreateFile { +

- Now, let's look at Java code that accomplishes the same task: + shows the equivalent code to create a file in Java.

- - + + import java.io.File; import java.io.IOException; @@ -148,6 +150,7 @@ public class CreateFile { } +