Q. What is the syntax for a method reference in Java 8?

  • (A) (args) -> ClassName::methodName
  • (B) ClassName::methodName(args)
  • (C) (args) -> methodName::ClassName
  • (D) methodName::ClassName(args)
πŸ’¬ Discuss
βœ… Correct Answer: (B) ClassName::methodName(args)
Explanation: Method references allow you to refer to an existing method as a lambda expression, without having to write out the full lambda syntax.
Explanation by: Pushkar
Method references allow you to refer to an existing method as a lambda expression, without having to write out the full lambda syntax.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
309
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Pushkar
Publisher
πŸ“ˆ
93%
Success Rate