diff --git a/source/ch8_filehandling.ptx b/source/ch8_filehandling.ptx index 05a8ca7..e2b96b4 100644 --- a/source/ch8_filehandling.ptx +++ b/source/ch8_filehandling.ptx @@ -4,17 +4,10 @@ File Handling - -

- File handling is an integral part of programming. Most programming languages have the ability to read from, write to, create, delete, move, and copy files. -

-
- -
Class Imports

- In Python, most built-in libraries are available without needing to explicitly import additional packages, but some libraries like math do need to be imported. Consider the following. + File handling is an integral part of programming. Most programming languages have the ability to read from, write to, create, delete, move, and copy files. In Python, most built-in libraries are available without needing to explicitly import additional packages, but some libraries like math do need to be imported. Consider the following.

@@ -42,12 +35,13 @@

- Java includes a class called File in the io library. The class can be imported with the following line. Be sure to capitalize File. + Much like the Math class, in order for your program to work with files you need to import classes from libraries. Java includes a class called File in the io library. This class allows you to create File objects, and use its public methods. the following code imports the File class and creates a File object called myFile. for now focus on how the class is imported and used in the program; We will cover the IOException class and createNewFile method later.

import java.io.File; - import java.io.IOException;public class Main { + import java.io.IOException; + public class Main { public static void main(String[] args) { try { File myFile = new File("newfile.txt");