This is the interface I'm using:
interface Command {
void run(int a, int b, int c);
void run(int a, int b, int c, int d, int e);
}
void add(Command c){
}
this is execution: (using the first run method)
add((a, b, c) -> System.out.println(""));
The error i get on the execution is:
The target type of this expression must be a functional interface
And this only goes away when i comment out the second run method.
I want to be able to execute the same interface using both run methods, and not have to create a new interface just to execute with method 2.
How?
addmethod. You call it withadd((a, b, c) -> System.out.println(""));. What do you expect to happen if, in the implementation ofadd, I callc.add(1,2,3,4,5);? Why do you expect that?