File Handling in Java
File Handling in Java
In java
Introduction
The File class from the java.io package, allows us to work with files.
To use the File class, create an object of the class, and specify the filename or
directory name:
we use the Scanner class to read the contents of the text file
import java.io.File; // Import the File class
import java.io.FileNotFoundException; // Import this class to handle errors
import java.util.Scanner; // Import the Scanner class to read text files