Given:
Which statement is true?
A. Moveable can be used as below:
Moveable<Integer> animal = n – > System.out.println(“Running” + n);
animal.run(100);
animal.walk(20);
B. Moveable can be used as below:
Moveable<Integer> animal = n – > n + 10;
animal.run(100);
animal.walk(20);
C. Moveable can be used as below:
Moveable animal = (Integer n) – > System.out.println(n);
animal.run(100);
Moveable.walk(20);
D. Movable cannot be used in a lambda expression.
A
A
A:
Running100
Walking
B:
incompatible types: bad return type in lambda expression
int cannot be converted to void
C:
incompatible types: incompatible parameter types in lambda expression
non-static method walk(Integer) cannot be referenced from a static context
So yes, the answer is “A”
A