Multiple choice technology programming languages

When comparing java.io.BufferedWriter to java.io.FileWriter, which capabilities exist as a method in only one of the two?

  1. Closing the stream

  2. flushing the stream

  3. writing to the stream

  4. writing a line separator to the stream

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

BufferedWriter has the newLine() method to write a platform-dependent line separator to the stream. FileWriter does not have a specific line-separator method and inherits standard write methods from OutputStreamWriter and Writer. Both classes support closing, flushing, and writing.