Which of the following classes is used to write characters to a file in Java?

  • BufferedReader
  • FileOutputStream
  • FileWriter
  • PrintWriter
The FileWriter class in Java is used to write characters to a file. It provides methods to write character data to a file in a character stream. FileOutputStream is used for writing binary data, PrintWriter is used for formatted text output, and BufferedReader is used for reading character data, not writing.
Add your answer
Loading...

Leave a comment

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