Return to site

JAVA CERTIFICATION QUESTION: FileWriter

· java,ocp

Which of the following statements is correct about a FileWriter?

  • A. It cannot write binary data
  • B. It doesn't use a buffer
  • C. It throws an exception if the target file already exists
  • D. It always uses UTF-8 as the character encoding
  • E. None of above

#java #certificationquestion #ocp

 

A FileWriter writes text to character files using a default buffer size.

Encoding from characters to bytes uses either a specified charset or the platform's default charset.

The FileWriter is meant for writing streams of characters.

For writing streams of raw bytes, consider using FileOutputStream.

·Ɐ sᴉ ɹǝsuɐ ʇɔǝɹɹoɔ ǝɥʇ :uoᴉsnʅɔuoꓛ