Q. What is the syntax to implement a `Runnable` using a lambda?

  • (A) () -> System.out.println("Run")
  • (B) (String s) -> System.out.println(s)
  • (C) x -> System.out.println(x)
  • (D) (int x, int y) -> x + y
πŸ’¬ Discuss
βœ… Correct Answer: (A) () -> System.out.println("Run")
Explanation: `Runnable` has no parameters, hence the lambda takes `()`.
Explanation by: Mr. Dubey
`Runnable` has no parameters, hence the lambda takes `()`.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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