Oracle
1Z0-809 · Question #275
QUESTION 299 Given the code fragment: List<String> str = Arrays.asList("pen", "is", "not", "a", "pencil"); if (name.length () < 60) { throw new UserException (); } else if (age > 60) { throw new…
The correct answer is E. A compilation error occurs. You've hit your session limit · resets 5:20pm (America/New_York)
Question
QUESTION 299
Given the code fragment:
List<String> str = Arrays.asList("pen", "is", "not", "a", "pencil");
if (name.length () < 60) {
throw new UserException ();
} else if (age > 60) {
throw new AgeOutOfLimitException ();
} else {
System.out.println("User is registered.");
}
Predicate<String> test = s -> {
int i = 0;
boolean result = s.contains ("pen");
System.out.print((i++) + ":");
return result;
};
str.stream()
.filter(test)
.findFirst()
.ifPresent(System.out ::print);
What is the result?
Options
- A0:0:pen
- B0:1:pen
- C0:pen
- D0:1:2:3:4:
- EA compilation error occurs.
How the community answered
(40 responses)- A3% (1)
- B8% (3)
- C3% (1)
- D15% (6)
- E73% (29)
Explanation
You've hit your session limit · resets 5:20pm (America/New_York)
Community Discussion
No community discussion yet for this question.