What is the role of FileWriter and FileReader in character streams when dealing with file I/O?

  • FileWriter and FileReader are used for binary data, not text data.
  • FileWriter and FileReader are used interchangeably, depending on whether you read or write data.
  • FileWriter is used for reading text data, and FileReader is used for writing text data.
  • FileWriter is used for writing text data to a file, and FileReader is used for reading text data.
FileWriter is used for writing text data to a file, while FileReader is used for reading text data from a file. These classes are specifically designed for character-based I/O operations and are suitable for working with text files. They automatically handle character encoding, making them convenient for text-based file operations.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *