What does the following do?
public class Shoot { interface Printable { boolean print(double angle); } // ww w . j a v a2s . co m static void prepare(double angle, Printable t) { boolean ready = t.print(angle); // k1 System.out.println(ready); } public static void main(String[] args) { prepare(45, d -> d > 5 || d < -5); // k2 } }
A.
This is a correct example of code that uses a lambda.
The interface has a single abstract method.
The lambda correctly takes one double parameter and returns a boolean.
This matches the interface.
The lambda syntax is correct.
Since 45 is greater than 5, Option A is correct.