+ 5

What is wrong?

interface MathOperation{ int operation(int a, int b); } class Dcoder { public static void main(String args[]) { MathOperation m=(int a,int b)->(a+b); int x=m(8,5); System.out.println("Hello, Dcoder!"+x); } }

11th Apr 2017, 12:08 PM
Prabhakar Dev
Prabhakar Dev - avatar
2 ответов
0
class Dcoder should implement the interface in order to use its components. write class Dcoder implements MathOperation
12th Apr 2017, 1:42 AM
Giannis Tsirovasilis
Giannis Tsirovasilis - avatar
+ 1
Yes, you need to implement the interface in Dcoder Class
28th Feb 2020, 9:00 AM
Balakrishna C
Balakrishna C - avatar