Oracle
1Z0-819 · Question #90
1Z0-819 Question #90: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-819 to reveal the answer and full explanation for question #90. The question stem and answer options stay visible for context.
Question
Given:
public class Main {
public static void main(String[] args) {
var numbers = List.of(1,2,3,4,5,6,7,8,9,10);
OptionalInt integer = numbers.stream().filter(x -> x % 3 != 0).reduce((i, j) -> i);
result.ifPresent(System.out::print); // line 1
}
}
Which is true about line 1?
Options
- AIf the value is not present, a NoSuchElementException is thrown at run time.
- BIf the value is not present, 0 is printed at run time.
- CIf the value is not present, a NullPointerException is thrown at run time.
- DThe variable result is not present, nothing is done.
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.