From bf5eed8ed164d1f0b0cc3d882d4944f30ceab0ae Mon Sep 17 00:00:00 2001
From: Habiba Sorour
File handling is an integral part of programming. Most programming languages have the ability to create, read from, write to, and delete, files. In Python, most built-in libraries are available without needing to explicitly import additional packages, but some libraries like
Delete the first line that says
Note the use of
import math
print(math.sqrt(25))
import java.lang.Math;
@@ -30,6 +35,8 @@
}
The
The
Finally, these last two classes provide error handling and must be used in tandem with the
Note the use of
- File handling is an integral part of programming. Most programming languages have the ability to create, read from, write to, and delete, files. In Python, most built-in libraries are available without needing to explicitly import additional packages, but some libraries like
- Delete the first line that says
import java.lang.Math;
@@ -42,7 +42,7 @@
- Much like the Math class, in order for your program to work with files you need use import . Java includes a class called File in the io library. This class allows you to create File objects, and use its public methods.
+ Much like the Math class, in order for your program to work with files you need use import . Java includes a class called File in the io library shown in . This class allows you to create File objects, and use its public methods.
@@ -52,7 +52,7 @@
- The Scanner class from the util library will need to be imported if there is any need for a program to read a file. It should be noted that this library is unnecessary if the program will not be reading any data from a file.
+ The Scanner class from the util library will need to be imported if there is any need for a program to read a file as shown in . It should be noted that this library is unnecessary if the program will not be reading any data from a file.
@@ -61,7 +61,7 @@
- The FileWriter class can be used to write to files. In the same way that the Scanner class isn't needed unless the program will read from a file, the FileWriter class isn't needed unless the program will write to a file.
+ The FileWriter class can be used to write to files as shown in . In the same way that the Scanner class isn't needed unless the program will read from a file, the FileWriter class isn't needed unless the program will write to a file.
@@ -71,7 +71,7 @@
- Finally, these last two classes provide error handling and must be used in tandem with the File class when reading from or writing to files. IOException handles file creation and writing errors, while FileNotFoundException handles errors when trying to read files.
+ Finally, these last two classes provide error handling and must be used in tandem with the File class when reading from or writing to files as shown in . IOException handles file creation and writing errors, while FileNotFoundException handles errors when trying to read files.