Given the code fragments:



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

A.

B.

C.

D.

題解

Java 8導入了Lambda語法,可以參考這篇文章來學習:

https://magiclen.org/java-8-lambda/

Predicate的JDK原始碼片段如下:

要實體化Predicate類別,必須要實作test方法。選項C是正確的Lambda語法的用法,可以實作出Predicate類別的test方法。