nerdexam
Oracle

1Z0-809 · Question #241

Given: class Person { private String firstName; private int salary; public Person(String fN, int sal) { this.firstName = fN; this.salary = sal; } public int getSalary() { return salary; } public…

The correct answer is B. 1500.0. You've hit your session limit · resets 5:20pm (America/New_York)

Question

Given: class Person { private String firstName; private int salary; public Person(String fN, int sal) { this.firstName = fN; this.salary = sal; } public int getSalary() { return salary; } public String getFirstName() { return firstName; } } and the code fragment: List<Person> prog = Arrays.asList( new Person("Smith", 1500), new Person("John", 2000), new Person("Joe", 1000)); double dVal = prog.stream() .filter(s -> s.getFirstName().startsWith("J")) .mapToInt(Person::getSalary) .average() .getAsDouble(); System.out.println(dVal); What is the result?

Options

  • A0.0
  • B1500.0
  • CA compilation error occurs.
  • D2000.0

How the community answered

(21 responses)
  • A
    5% (1)
  • B
    86% (18)
  • D
    10% (2)

Explanation

You've hit your session limit · resets 5:20pm (America/New_York)

Community Discussion

No community discussion yet for this question.

Full 1Z0-809 Practice