As i am practising the enthuware for OCP in JDK 1.8, i have encountered a quuestion which has three options as answers. I have not understood why those three are correct, especially the third option. Please find the code below:
Isn't this how lambda works, if you need an instance of an interface, and the interface is functional i.e. it only has one abstract method, then you can use any method with the same parameters and return type as an implementation of the interface using lambda. In this case the interface has more methods with default implementation, but for any method to be used as an implementation of the interface, you only need to worry about the abstract method in the interface.
To add to Salvin's answer, can you do this:
In the same way do the lambda in all the other options qualify as implementation of Carnivore interface.