raw type UnaryOperator uo = (var x)->(x*3);
is actually
UnaryOperator<Object>
we have :
x*3 Object*3 - error
A. is Ok
B.
UnaryOperator uo = (int x)->(x*3);
MyClass.java:9: error: incompatible types: incompatible parameter types in lambda expression
UnaryOperator<Integer> uo = (int x)->(x*3);
C.
UnaryOperator<Integer> uo = var x->(return x*3);
Fail
skip parentheses
D
UnaryOperator<Integer> uo = x->{return x*3;};
Fail
terminator(;) is missing
a IS CORRECT;
B is incorrect (primitives types cannot pass to lambda as parameter ONLY wrapper type)
C bad sintax
D bad sintax if return then { ; } must be
A is valid if it looks like this
UnaryOperator<Integer> uo = (var x) -> (x * 3);
upvoted 3 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
ASPushkin
3 months, 2 weeks agod7bb0b2
6 months, 1 week agoOmnisumem
9 months, 1 week agoStavok
12 months agoKiraguJohn
1 year ago