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?
A.
DOSFileAttributes attrs = Files.setAttribute(file,”dos:hidden”,”dos: readonly”)
Files.createFile(file, attrs)
B.
Files.craeteFile(file);
Files.setAttribute(file,”dos:hidden”,”dos:readonly”);
C.
Files.createFile(file,”dos:hidden”,”dos:readonly”);
D.
Files.createFile(file);
Files.setAttribute(file,”dos:hidden”, true);
Files.setAttribute(file,”dos:readonly”, true);
Explanation:
You can set a DOS attribute using the setAttribute(Path, String, Object, LinkOption…) method, as
follows:
Path file = …;
Files.setAttribute(file, “dos:hidden”, true);
Note:
setAttribute
public static Path setAttribute(Path path,String attribute,
Object value,
LinkOption… options)
throws IOException
Sets the value of a file attribute.
Reference:Interface DosFileAttribute
D