Oracle
1Z0-809 · Question #207
1Z0-809 Question #207: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #207. The question stem and answer options stay visible for context.
Question
Given:
public interface LengthValidator {
public boolean checkLength(String str);
}
and
public class Txt {
public static void main(String[] args) {
boolean res = new LengthValidator() {
public boolean checkLength(String str) {
return str.length() > 5 && str.length() < 10;
}
}.checkLength("Hello");
}
}
Which interface from the java.util.function package should you use to refactor the class Txt?Options
- AConsumer
- BPredicate
- CSupplier
- DFunction
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.