Sobes.tech
Middle
196

Millistele muutujatele pääsevad Java lambda-väljendid?

Vastus AI-lt

sobes.tech AI

Lambda expressions have access to the following types of variables:

  • Local environment variables: Only those local static, non-static, or instance variables that are final or effectively final.
  • Method parameters: The parameters of the method in which the lambda expression is declared, if they are final or effectively final.
  • Class fields: The fields of the current class (for non-static lambdas) and the static fields of the class.

A variable is considered effectively final if its value does not change after initialization.