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

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

Moderator: admin

Post Reply
bhuva78
Posts: 1
Joined: Mon Oct 29, 2018 4:08 pm
Contact:

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

Post by bhuva78 »

Why does it fail to compile?

crazymind
Posts: 85
Joined: Mon Dec 24, 2018 6:24 pm
Contact:

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

Post by crazymind »

lambda expression does not create a new scope for variables.Therefore, you cannot reuse the local variable names that have already been used in the enclosing method
So e's scope is between the parentheses "(e, e->e.age<10000)" ?

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

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

Post by admin »

Yes, you can try it out. Use the the variable specified in the lambda expression after the expression and see what happens.

raphaelzintec
Posts: 167
Joined: Sun Apr 21, 2024 10:43 am
Contact:

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

Post by raphaelzintec »

this one is very funny cuz i answeared 'It will compile fine and print true when run.' but then i went back cuz i realized the question was too easy, like something is missing, the trickyness is missing, so ye i doublechecked and found lol

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 12 guests