About Question enthuware.ocajp.i.v8.2.1471 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
Celina
Posts: 2
Joined: Thu Sep 06, 2018 5:31 am
Contact:

About Question enthuware.ocajp.i.v8.2.1471 :

Post by Celina » Sun Oct 28, 2018 12:49 am

Why below is wrong
() -> true
I saw in the OCA study book, the parameter can be 0 and below is valid
print(()->true);

Online
admin
Site Admin
Posts: 8704
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.1471 :

Post by admin » Sun Oct 28, 2018 2:41 am

Did you read the explanation for this option? It explains why this is invalid.
As per the problem statement, you have to pick only such a lambda expression that can be used to invoke a method that accepts a java.util.function.Predicate.

() -> true is a valid lambda expression as such but it cannot implement a Predicate.
If you like our products and services, please help us by posting your review here.

BespawlerC
Posts: 1
Joined: Sun Oct 28, 2018 12:02 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.1471 :

Post by BespawlerC » Sun Oct 28, 2018 12:06 pm

admin wrote:
Sun Oct 28, 2018 2:41 am
Did you read the explanation for this option? It explains why this is invalid.
As per the problem statement, you have to pick only such a lambda expression that can be used to invoke a method that accepts a java.util.function.Predicate.

() -> true is a valid lambda expression as such but it cannot implement a Predicate.
Very nicely explained :thumbup:

Celina
Posts: 2
Joined: Thu Sep 06, 2018 5:31 am
Contact:

Re: About Question enthuware.ocajp.i.v8.2.1471 :

Post by Celina » Tue Oct 30, 2018 5:46 am

admin wrote:
Sun Oct 28, 2018 2:41 am
Did you read the explanation for this option? It explains why this is invalid.
As per the problem statement, you have to pick only such a lambda expression that can be used to invoke a method that accepts a java.util.function.Predicate.

() -> true is a valid lambda expression as such but it cannot implement a Predicate.
Sorry English is my 2nd lanugage, just misunderstood the question , now I get it. Thanks.

Post Reply

Who is online

Users browsing this forum: admin and 3 guests