What is the result?

Given the definition of the Emp class:


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.

Download Printable PDF. VALID exam to help you PASS.

4 thoughts on “What is the result?

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.