Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817
Moderator: admin
Emanuel_Swe
Posts: 2 Joined: Tue Mar 27, 2018 8:42 am
Contact:
Post
by Emanuel_Swe » Tue Mar 27, 2018 8:57 am
Hello. I wonder if there is a special reason for writing the type
in the lambda expression. You wrote that the expression in first option was syntactically correct.
Greetings V. Ekholm
Attachments
Q 52 in enthuware.ocajp.i.v8.2.1469 Question 52.jpg (193.6 KiB) Viewed 2398 times
admin
Site Admin
Posts: 10388 Joined: Fri Sep 10, 2010 9:26 pm
Contact:
Post
by admin » Tue Mar 27, 2018 10:39 am
As the explanation says, the variable name in the lambda cannot be d because d is already used in the method. That is why even though syntax of the lamda in option 1 is correct but it will not compile. Data x doesn't have that problem.
Emanuel_Swe
Posts: 2 Joined: Tue Mar 27, 2018 8:42 am
Contact:
Post
by Emanuel_Swe » Tue Mar 27, 2018 2:41 pm
Thank you, I just wonder why it says "(Data x)->" and not just "(x)->"
admin
Site Admin
Posts: 10388 Joined: Fri Sep 10, 2010 9:26 pm
Contact:
Post
by admin » Tue Mar 27, 2018 9:06 pm
There is no special reason for that.
Users browsing this forum: No registered users and 7 guests