Skip to content

Commit 291413d

Browse files
committed
add xml:ids to programs in ch3
1 parent ba6a835 commit 291413d

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

source/ch2_firstjavaprogram.ptx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
The best way to understand classes and objects is to see them in action. Let's define a <c>Dog</c> class in Python:
3131
</p>
3232

33-
<program language="python" xml:id="python-class-example">
33+
<program xml:id="python-class-example" language="python">
3434
<code>
3535
class Dog:
3636
def __init__(self, name, breed, fur_color):

source/ch3_javadatatypes.ptx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
</p>
9696

9797

98-
<program interactive="activecode" language="python">
98+
<program xml:id="python-temperature-conversion" interactive="activecode" language="python">
9999
<code>
100100
def main():
101101
fahr = int(input("Enter the temperature in F: "))
@@ -110,7 +110,7 @@ main()
110110
</p>
111111

112112

113-
<program interactive="activecode" language="java">
113+
<program xml:id="java-temperature-conversion" interactive="activecode" language="java">
114114
<code>
115115
import java.util.Scanner;
116116
public class TempConv {
@@ -431,7 +431,7 @@ if (myAnimal instanceof Dog) {
431431
</p>
432432

433433

434-
<program interactive="activecode" language="python">
434+
<program xml:id="python-input-file1" interactive="activecode" language="python">
435435
<code>
436436
def main():
437437
count = [0]*10
@@ -528,7 +528,7 @@ Here is the Java code needed to write the exact same program:
528528
</p>
529529
</note>
530530

531-
<program interactive="activecode" language="java" datafile="test.dat">
531+
<program xml:id="java-null-object" interactive="activecode" language="java" datafile="test.dat">
532532
<code>
533533
import java.util.Scanner;
534534
import java.util.ArrayList;
@@ -655,11 +655,11 @@ public class Histo {
655655
<title>Arrays</title>
656656

657657
<p>
658-
As I 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 arrays. In fact you have already seen one example of an array declared in the &#x2018;Hello World&#x2019; program. Lets rewrite this program to use primitive arrays rather than array lists.
658+
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.
659659
</p>
660660

661661

662-
<program interactive="activecode" language="java" datafile="test.dat">
662+
<program xml:id="java-array" interactive="activecode" language="java" datafile="test.dat">
663663
<code>
664664
import java.util.Scanner;
665665
import java.io.File;
@@ -708,7 +708,7 @@ public class HistoArray {
708708
</p>
709709

710710

711-
<program interactive="activecode" language="python">
711+
<program xml:id="python-input-file2" interactive="activecode" language="python">
712712
<code>
713713
def main():
714714
data = open('alice30.txt')
@@ -755,7 +755,7 @@ main()
755755
</p>
756756

757757

758-
<program interactive="activecode" language="java" datafile="alice30.txt">
758+
<program xml:id="java-use-input-file" interactive="activecode" language="java" datafile="alice30.txt">
759759
<code>
760760
import java.util.Scanner;
761761
import java.util.ArrayList;

0 commit comments

Comments
 (0)