Assuming the current directory is /data/cute, which are possible results of executing the following code? (Choose all that apply.).
Files.walk(Paths.get("..").toRealPath().getParent()) // u1 .map(p -> p.toAbsolutePath().toString()) // u2 .filter(s -> s.endsWith(".java")) // u3 .collect(Collectors.toList()) .forEach(System.out::println);
A, G.
The code compiles without issue, so B, C, and D are incorrect.
The first line actually resolves to the root path since .. and getParent()
are conceptually equivalent.
Therefore, G is correct and E and F are incorrect.
A is also correct since it may encounter a file that it does not have access to read, which is common when trying to read an entire file system.