Skip to content

Commit 7e5e090

Browse files
committed
added listing in text
1 parent 99b99c0 commit 7e5e090

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

source/ch3_javadatatypes.ptx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ public class Histo {
777777
<title>Arrays</title>
778778

779779
<p>
780-
As was said at the outset of this section, we are going to use Java <c>ArrayLists</c> 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 &#x2018;Hello World&#x2019; program. Let's rewrite this program to use primitive arrays rather than array lists.
780+
As was said at the outset of this section, we are going to use Java <c>ArrayLists</c> 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 &#x2018;Hello World&#x2019; program. <xref ref="java-array" text="type-global"/> is a rewritten version of <xref ref="java-histogram" text="type-global"/> that uses primitive arrays rather than array lists.
781781
</p>
782782

783783
<listing xml:id="java-array">
@@ -815,7 +815,7 @@ public class HistoArray {
815815
</listing>
816816

817817
<p>
818-
The main difference between this example and the previous example is that we declare <c>count</c> to be an <c>Array</c> of integers. We also can initialize short arrays directly using the syntax shown here: <c>Integer[] count = {0,0,0,0,0,0,0,0,0,0}</c>Then notice that we can use the square bracket notation <c>count[idx]</c> to index into an array.
818+
The main difference between <xref ref="java-array" text="type-global"/> and <xref ref="java-histogram" text="type-global"/> is that we declare <c>count</c> to be an <c>Array</c> of integers. We also can initialize short arrays directly using the syntax shown here: <c>Integer[] count = {0,0,0,0,0,0,0,0,0,0}</c>Then notice that we can use the square bracket notation <c>count[idx]</c> to index into an array.
819819
</p>
820820
</section>
821821

0 commit comments

Comments
 (0)