Mastering Java: The Ultimate Quiz for 'Thinking in Java'

Disable ads (and more) with a membership for a one time $2.99 payment

Prepare for your Java exam with our ultimate quiz based on 'Thinking in Java'. Engage with expertly crafted questions that enhance your learning process. Perfect for Java enthusiasts looking to solidify their knowledge!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What does the FileWriter class do?

  1. Writes bytes to a file

  2. Writes characters to a file

  3. Reads characters from a file

  4. Reads bytes from a file

The correct answer is: Writes characters to a file

The FileWriter class is specially designed for writing characters to a file. It is used to write text to a character-based output stream, making it unsuitable for writing bytes to a file. The other options are incorrect because they do not accurately describe the purpose of the FileWriter class. FileWriter is not used for reading characters or bytes from a file, but rather for writing data to a file. Therefore, the correct answer is B.