Which code fragment, when inserted at line n1, enables the code to print Hank?

Given the code fragments: Which code fragment, when inserted at line n1, enables the code
to print Hank?

Given the code fragments: Which code fragment, when inserted at line n1, enables the code
to print Hank?

A.
checkAge(iList, Person p -> p.getAge( ) > 40);

B.
checkAge (iList, p -> p.getAge ( ) > 40);

C.
checkAge(iList, (Person p) -> { p.getAge() > 40; });

D.
checkAge (iList, ( ) -> p. get Age ( ) > 40);

Explanation:



Leave a Reply 4

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


IO

IO

B.
checkAge (iList, p -> p.getAge ( ) > 40);

Kaykay

Kaykay

Definitely B.

Tomas

Tomas

Answer: B

// A
//checkAge(iList, Person p->p.getAge() > 40); // error

// B
//checkAge(iList, p->p.getAge() > 40); // OK

// C
//checkAge(iList, (Person p)->{p.getAge() > 40;}); // error

// D
//checkAge(iList, ()->p.getAge() > 40); // error