Here, you will learn about the FileReader class with the help of the code we already have (see the preceding code). Firstly, go through the following steps:
- I've declared FileWriter and FileReader objects for us. FileReader is a sister class of FileWriter. It's capable of, believe it or not, reading text input from files, and it's constructed in a very similar manner. It expects to be given a file to be associated with throughout its life when it's constructed.
- Rather than simply giving the FileReader and FileWriter paths to these files, I've chosen to create File objects. The Java file object is simply a reference to an existing file, and we tell that file what file it will reference when it's created ...