How does the FileWriter class handle character encoding?

  • It always uses the system's default character encoding.
  • It automatically detects and sets the appropriate character encoding.
  • It doesn't support character encoding; it writes bytes as is.
  • It prompts the user to choose the encoding when creating an instance.
The FileWriter class in Java uses the system's default character encoding for writing text to a file. It doesn't automatically detect or set character encoding. To specify a different encoding, you should use constructors like FileWriter(String fileName, Charset charset) to explicitly set the encoding.
Add your answer
Loading...

Leave a comment

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