Q. What is captured from the enclosing scope in a lambda expression?

  • (A) Local variables only if they are final or effectively final
  • (B) All variables regardless of finality
  • (C) Class variables only
  • (D) No variables are captured
πŸ’¬ Discuss
βœ… Correct Answer: (A) Local variables only if they are final or effectively final
Explanation: Lambdas can capture variables from the enclosing scope if they are final or effectively final.
Explanation by: Mr. Dubey
Lambdas can capture variables from the enclosing scope if they are final or effectively final.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
68
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
98%
Success Rate