The FileReader and BufferedReader class

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:

  1. 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.
  2. 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 ...

Get Java Programming for Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.