Which of the following methods does not close the file stream after appending the content to the file?

  • BufferedWriter's append method
  • FileWriter's append method
  • PrintWriter's append method
  • RandomAccessFile's writeBytes method
The BufferedWriter class in Java provides the append method for adding content to a file without closing the stream. This is useful when you want to continue writing to the same file later without reopening and closing it each time. The other options do not offer this behavior; they typically close the file stream after writing, making it less suitable for appending content.
Add your answer
Loading...

Leave a comment

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