Skip to content

Commit f46f5ef

Browse files
committed
add listing tags
1 parent 35cc975 commit f46f5ef

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

source/ch8_filehandling.ptx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
<p>
7676
We will now create a <c>File</c> object. It is important to create a meaningful name for the <c>File</c> object. We will call ours <c>myFile</c>, and we will call our class <c>CreateFileObject</c>.
7777
</p>
78-
79-
<program xml:id="create-file-object-java" interactive="activecode" language="java" add-files="myfile-created">
78+
<listing xml:id="create-file-object-java">
79+
<program interactive="activecode" language="java" add-files="myfile-created">
8080
<code>
8181
import java.io.File;
8282

@@ -90,6 +90,7 @@ public class CreateFile {
9090
}
9191
</code>
9292
</program>
93+
</listing>
9394

9495
<note>
9596
<p>
@@ -105,8 +106,8 @@ public class CreateFile {
105106
<p>
106107
First, lets look at the equivalent Python code:
107108
</p>
108-
109-
<program xml:id="create-file-python" interactive="activecode" language="python">
109+
<listing xml:id="create-file-python">
110+
<program interactive="activecode" language="python">
110111
<code>
111112
filename = "newfile.txt"
112113
print("Attempting to write to '" + filename + "' using 'w' mode...")
@@ -120,12 +121,13 @@ public class CreateFile {
120121

121122
</code>
122123
</program>
124+
</listing>
123125

124126
<p>
125127
Now, let's look at Java code that accomplishes the same task:
126128
</p>
127-
128-
<program xml:id="create-file-java" interactive="activecode" language="java">
129+
<listing xml:id="create-file-java">
130+
<program interactive="activecode" language="java">
129131
<code>
130132
import java.io.File;
131133
import java.io.IOException;
@@ -148,6 +150,7 @@ public class CreateFile {
148150
}
149151
</code>
150152
</program>
153+
</listing>
151154

152155
<note>
153156
<p>

0 commit comments

Comments
 (0)