Oracle
1Z0-809 · Question #189
1Z0-809 Question #189: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #189. The question stem and answer options stay visible for context.
Question
Given the content of the employee.txt file:
Every worker is a master.
Given that the employee.txt file is accessible and the file allEmp.txt does NOT exist, and the code fragment:
try {
List<String> content = Files.readAllLines(Paths.get("employee.txt"));
content.stream().forEach(line -> {
try {
Files.write(
Paths.get("allEmp.txt"),
line.getBytes(),
StandardOpenOption.APPEND
);
} catch (IOException e) { System.out.println("Exception 1"); }
});
} catch (IOException e) { System.out.println("Exception 2"); }
What is the result?
Options
- AException 1
- BException 2
- CThe program executes, does NOT affect the system, and produces NO output.
- DallEmp.txt is created and the content of employee.txt is copied to it.
Unlock 1Z0-809 to see the answer
You've previewed enough free 1Z0-809 questions. Unlock 1Z0-809 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.