Oracle
1Z0-809 · Question #221
1Z0-809 Question #221: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #221. The question stem and answer options stay visible for context.
Question
Given the definition of the Emp class:
public class Emp {
private String eName;
private Integer eAge;
Emp(String eN, Integer eA) {
this.eName = eN;
this.eAge = eA;
}
public Integer getEAge() {return eAge;}
public String getEName() {return eName;}
}
and code fragment:
List<Emp>ll = Arrays.asList(new Emp("Sam", 20), New Emp("John", 60),
New Emp("Jill", 51));
Predicate<Emp> pEval = s -> s.getEAge() <= 60; //line n1
ll = ll.stream().filter(pEval).collect (Collectors.toList());
Stream<String> names = ll.stream().map (Emp::getEName); //line n2
names.forEach(n -> System.out.print (n + " "));
What is the result?
Options
- ASam John Jim
- BJohn Jim
- CA compilation error occurs at line n1.
- DA compilation error occurs at line n2.
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.