My problem with these questions about invalid OpenOption combinations is, that IMO the reason because the JavaDoc does not explicitly mention which combinations are invalid is that there are no global invalid combinations. It depends on the operation (read or write), and whether a file exists or not.
For example answer 4 states, that
This is true for an InputStream, but the Files.newBufferedWriter method accepts this combination if the file does not exist. The combination InputStream + APPEND is invalid, not the the combination of the the APPEND + CREATE_NEW.new OpenOption[]{StandardOpenOption.APPEND, StandardOpenOption.CREATE_NEW}
This throws java.lang.UnsupportedOperationException: 'APPEND' not allowed.
Also answer 5:
The Files.newBufferedWriter method throws a java.lang.IllegalArgumentException: READ not allowed but it works with an InputStream. Again, the combination itself is not invalid, it just depends on the operation.new OpenOption[]{StandardOpenOption.READ, StandardOpenOption.SYNC}
Ideally, this should be an invalid combination (because when a file is opened for READ, there is nothing to synch) but it works.
or did I miss something here?
Thanks