ExamQuestions.com

Register
Login
Java SE 8 Programmer II Exam Questions

Oracle

Java SE 8 Programmer II

50 / 130

Question 50:

The data.doc, data.txt and data.xml files are accessible and contain text. Given the code fragment: Stream<Path> paths = Stream.of (Paths. get("data.doc"), Paths. get("data.txt"), Paths. get("data.xml")); paths.filter(s-> s.toString().contains("data")).forEach( s -> { try { Files.readAllLines(s) .stream() .forEach(System.out::println); //line n1 } catch (IOException e) { System.out.println("Exception"); } } ); What is the result? 

Answer options:

A. The program prints the content of data.txt file.
B. The program prints: Exception <<The content of the data.txt file>> <<The content of the data.xml file>>
C. A compilation error occurs at line n1.
D. The program prints the content of the three files.