How to use class instead of interface for lambda param

You cannot use class instead of Interface ( Precisely to say Fuctional Interface).

See the link to know why do we need functional Interface to work with lambda in java.

In your case you are trying to use a class , which will obviously have
name, isn’t. but to use lambda we have to use anonymous functions
which don’t have name and type.

Leave a Comment