Skip to content

Commit 6745032

Browse files
committed
fix 8.2
1 parent 3fd0af0 commit 6745032

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

source/ch8_filehandling.ptx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,22 @@
7373

7474

7575
<p>
76-
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>. We will also call our class <c>CreateFile</c>
76+
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>
7878

79-
<program xml:id="create-file-class-java" interactive="activecode" language="java" add-files="myfile-created">
80-
<input>
81-
import java.io.File;
82-
public class CreateFile {
83-
public static void main(String[] args) {
84-
import java.io.File;
85-
File myFile = new File("myfile.txt");
86-
System.out.println(myFile);
87-
}
88-
}
89-
</input>
79+
<program xml:id="create-file-object-java" interactive="activecode" language="java" add-files="myfile-created">
80+
<code>
81+
import java.io.File;
82+
83+
public class CreateFile {
84+
public static void main(String[] args) {
85+
// First, create a File object that represents "myfile.txt"
86+
File myFile = new File("myfile.txt");
87+
// Mext, print the file path (just the filename.)
88+
System.out.println(myFile);
89+
}
90+
}
91+
</code>
9092
</program>
9193

9294
<note>

0 commit comments

Comments
 (0)