exam questions

Exam 1z0-809 All Questions

View all questions & answers for the 1z0-809 exam

Exam 1z0-809 topic 1 question 64 discussion

Actual exam question from Oracle's 1z0-809
Question #: 64
Topic #: 1
[All 1z0-809 Questions]

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>li = Arrays.asList(new Emp("Sam", 20), New Emp("John", 60), New Emp("Jim", 51));
Predicate<Emp> agVal = s -> s.getEAge() > 50; //line n1 li = li.stream().filter(agVal).collect(Collectors.toList());
Stream<String> names = li.stream()map.(Emp::getEName); //line n2 names.forEach(n -> System.out.print(n + " "));
What is the result?

  • A. Sam John Jim
  • B. John Jim
  • C. A compilation error occurs at line n1.
  • D. A compilation error occurs at line n2.
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
thetech
Highly Voted 4 years, 8 months ago
Answer is B. Tested
upvoted 7 times
...
asdfjhfgjuaDCV
Most Recent 4 months, 3 weeks ago
B is the correct answer
upvoted 1 times
...
steefaand
5 months, 3 weeks ago
Selected Answer: B
B is correct.
upvoted 1 times
...
luchvA123
11 months, 2 weeks ago
B is correct
upvoted 1 times
...
Destroyer
4 years, 7 months ago
Answer should be "John Jim"
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago