1Z0-804 · Question #115
Given the code fragment: And a DOS-based file system: Which option, containing statement(s), inserted at line 3, creates the file and sets its attributes to hidden and read-only?
The correct answer is D. Files.createFile(file). You can set a DOS attribute using the setAttribute(Path, String, Object, LinkOption...) method, as Path file = ...; Files.setAttribute(file, "dos:hidden", true); public static Path setAttribute(Path path, String attribute, LinkOption... options) throws IOException Sets the…
Question
Given the code fragment:
And a DOS-based file system:
Which option, containing statement(s), inserted at line 3, creates the file and sets its attributes to hidden and read-only?
Options
- ADOSFileAttributes attrs = Files.setAttribute(file,"dos:hidden","dos: readonly")
- BFiles.craeteFile(file);
- CFiles.createFile(file,"dos:hidden","dos:readonly");
- DFiles.createFile(file);
How the community answered
(33 responses)- A3% (1)
- B9% (3)
- C3% (1)
- D85% (28)
Explanation
You can set a DOS attribute using the setAttribute(Path, String, Object, LinkOption...) method, as Path file = ...; Files.setAttribute(file, "dos:hidden", true); public static Path setAttribute(Path path, String attribute, LinkOption... options) throws IOException Sets the value of a file attribute.
Topics
Community Discussion
No community discussion yet for this question.