My code is something like this,
@FunctionalInterface
interface MathOperation2 {
int operation2(int a, int b, int c);
}
public class Method_reference_demo {
private static int operate2(int a, int b, int c, MathOperation2 obj)
{
return obj.operation2(a, b, c);
}
private void Method_reference_demo01()
{
MathOperation2 mo2 = Method_reference_demo::operate2;
mo2.operation2(2,3,4);
}
}
is there anyway I can make it work by passing parameter through last two lines.
means below lines.
MathOperation2 mo2 = Method_reference_demo::operate2;
mo2.operation2(2,3,4);
I want above snippet as working code.
NOTE: I can't change any line of code except these two lines and want to use Java 8 Method reference.