From 99b99c09769ab0b4388735d70fcd836d813c8e9d Mon Sep 17 00:00:00 2001
From: Habiba Sorour
Date: Mon, 27 Jul 2026 20:46:54 +0300
Subject: [PATCH 1/2] add listing
---
source/ch3_javadatatypes.ptx | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/source/ch3_javadatatypes.ptx b/source/ch3_javadatatypes.ptx
index 199b13b..e87cf82 100644
--- a/source/ch3_javadatatypes.ptx
+++ b/source/ch3_javadatatypes.ptx
@@ -780,8 +780,8 @@ public class Histo {
As was said at the outset of this section, we are going to use Java ArrayLists because they are easier to use and more closely match the way that Python lists behave. However, if you look at Java code on the internet or even in your core Java books you are going to see examples of something called an array. In fact, you have already seen one example of an array declared in the ‘Hello World’ program. Let's rewrite this program to use primitive arrays rather than array lists.
-
-
+
+
import java.util.Scanner;
import java.io.File;
@@ -812,6 +812,7 @@ public class HistoArray {
}
+
The main difference between this example and the previous example is that we declare count to be an Array of integers. We also can initialize short arrays directly using the syntax shown here: Integer[] count = {0,0,0,0,0,0,0,0,0,0}Then notice that we can use the square bracket notation count[idx] to index into an array.
From 7e5e090f63827566ce826f1e6015d5f88d5aa5a4 Mon Sep 17 00:00:00 2001
From: Habiba Sorour
Date: Mon, 27 Jul 2026 20:53:13 +0300
Subject: [PATCH 2/2] added listing in text
---
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 e87cf82..932aef3 100644
--- a/source/ch3_javadatatypes.ptx
+++ b/source/ch3_javadatatypes.ptx
@@ -777,7 +777,7 @@ public class Histo {
Arrays
- As was said at the outset of this section, we are going to use Java ArrayLists because they are easier to use and more closely match the way that Python lists behave. However, if you look at Java code on the internet or even in your core Java books you are going to see examples of something called an array. In fact, you have already seen one example of an array declared in the ‘Hello World’ program. Let's rewrite this program to use primitive arrays rather than array lists.
+ As was said at the outset of this section, we are going to use Java ArrayLists because they are easier to use and more closely match the way that Python lists behave. However, if you look at Java code on the internet or even in your core Java books you are going to see examples of something called an array. In fact, you have already seen one example of an array declared in the ‘Hello World’ program. is a rewritten version of that uses primitive arrays rather than array lists.
@@ -815,7 +815,7 @@ public class HistoArray {
- The main difference between this example and the previous example is that we declare count to be an Array of integers. We also can initialize short arrays directly using the syntax shown here: Integer[] count = {0,0,0,0,0,0,0,0,0,0}Then notice that we can use the square bracket notation count[idx] to index into an array.
+ The main difference between and is that we declare count to be an Array of integers. We also can initialize short arrays directly using the syntax shown here: Integer[] count = {0,0,0,0,0,0,0,0,0,0}Then notice that we can use the square bracket notation count[idx] to index into an array.