Which of the following is a key characteristic of a lambda expression in Java?

  • It can capture local variables.
  • It can have multiple methods.
  • It is a data type.
  • It is an anonymous inner class.
A key characteristic of a lambda expression in Java is that it can capture local variables from its enclosing scope. This allows lambda expressions to use values from the surrounding context, making them useful for creating concise and expressive code.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *