I'm learning lambda, and I know the 3 steps rule which is:
MyInterface myInterface = new MyInterface()
{
@Override
public void printMe(String message) {
System.out.println(message);
}
};
Is the answer
MyInterface myInterface = new MyInterface(message -> message);
Or
MyInterface myInterface = message -> System.out.println(message);
Or I maybe all wrong...?
The second option is correct. But note you could clean the code up even further by using method references:
MyInterface myInterface = System.out::println;