Which two fragments, when inserted independently at line **, enable printing of the file size?

Given the code fragment:
<code>
11. public static getFileSize () throws IOException {
12. path file = paths.get (“ex.txt”);
13. //insert code here
14. System.out.println (“size: ” + attr.size());
15. }
public static getFileSize () throws IOException {
Path file = Paths.get (“ex.txt”);
//insert code here Line **
System.out.println (“size: ” + attr.size());
}
</code>
Which two fragments, when inserted independently at line **, enable printing of the file size?

Given the code fragment:

11. public static getFileSize () throws IOException {
12. path file = paths.get ("ex.txt");
13. //insert code here
14. System.out.println ("size: " + attr.size());
15. }
public static getFileSize () throws IOException {
Path file = Paths.get ("ex.txt");
//insert code here Line **
System.out.println ("size: " + attr.size());
}

Which two fragments, when inserted independently at line **, enable printing of the file size?

A.
BasicFileAttributes attr = Files.readAttributes (file, BasicFileAttributes.class);

B.
PosixFileAttributes attr = Files.readAttributes (file, posixFileAttributes.class);

C.
DosFileAttributes attr = Files.readAttributes (file, dosAttributes.class);

D.
FileStore attr = Files.getFileStore (file);

E.
AclFileAttributeview attr = Files.getFileAttributeView(File, AclFileAttributeview.class);

Explanation:
A: The BasicFileAttributes has a size method.
B: The PosixFileAttributes has a size method.



Leave a Reply 0

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