Oracle
1Z0-819 · Question #62
1Z0-819 Question #62: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-819 to reveal the answer and full explanation for question #62. The question stem and answer options stay visible for context.
Question
Given
try { // line 1
lines.map(l -> l.toUpperCase())
.forEach (line -> {
try {
Files.write(Paths.get("outputfile_to_path"),
line.getBytes(),StandardOpenOption.CREATE);
} catch (IOException e) {
e.printStackTrace();
}
});
} catch (IOException e) {
e.printStackTrace();
}
You want to obtain the Stream object on reading the file. Which code inserted on line 1 will accomplish this?
Options
- AA. var lines = Files.lines(Paths.get(INPUT_FILE_NAME));
- BB. Stream<String> files = Files.lines(Paths.get(INPUT_FILE_NAME));
- CC. var lines = Files.readAllLines(Paths.get(INPUT_FILE_NAME));
- DD. Stream<String> lines = Files.lines(INPUT_FILE_NAME);
Unlock 1Z0-819 to see the answer
You've previewed enough free 1Z0-819 questions. Unlock 1Z0-819 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.