The official documentation of
Files.newBufferedWriter is oddly unclear about what to do in this case.
Fortunately, I've written a few file system implementations myself, and therefore know that implementing a file system does not require implementing any methods for creating a writer. The only writable objects you can create are:
* an OutputStream:
Files.newOutputStream
* a SeekableByteChannel:
Files.newByteChannel
The documentation for
newOutputStream clearly states that APPEND without CREATE should cause an exception to be thrown if the file does not exist. Therefore, answer C is correct, and the answer explanation is incorrect.