Exam 1z0-819 All QuestionsBrowse all questions from this exam
Question 22

Which two are valid statements? (Choose two.)

    Correct Answer: B, E

    The valid statements involve parameters where the combination of data types and usage of the 'var' keyword are consistent with Java's rules for lambda parameter types. Statement (B) correctly uses 'var' for both parameters, and 'final' can be applied to 'var' parameters. Statement (E) uses explicitly typed parameters with 'final' as well, which is also valid in Java. Invalid statements either mix 'var' with explicitly typed parameters or omit necessary type declarations.

Discussion
RP384Options: BE

B and E are correct

Leksh_geethOptions: BE

Correct answer is BE

d7bb0b2Options: BE

B AND E: BiPredicate<Integer, Integer> test = (final Integer x, var y) -> (x.equals(y)); => BAD MIX TYPES BiPredicate<Integer, Integer> test2 = (var x, final var y) -> (x.equals(y)); => OK BiPredicate<Integer, Integer> test3 = (Integer x, final var y) -> (x.equals(y)); => MIX BiPredicate<Integer, Integer> test4 = (final var x, y) -> (x.equals(y)); => Y NOT TYPE BiPredicate<Integer, Integer> test5 = (Integer x, final Integer y) -> (x.equals(y)); => OK

OmnisumemOptions: BE

Tested: B and E.

Abu_MuhammadOptions: BE

B and E, as var parameters cannot be mixed with other (typed) parameters

JGR_77Options: BE

BiPredicate<Integer, Integer> test = (var x, final var y) -> (x.equals(y)); BiPredicate<Integer, Integer> test2 = (Integer x, final Integer y) -> (x.equals(y));

gnilapon.ebenezaireOptions: BE

Good definitions

[Removed]Options: BE

BE are correct

StavokOptions: BE

B&E are correct