Why can’t I assign lambda to Object?

It’s not possible. As per the error message Object is not a functional interface, that is an interface with a single public method so you need to use a reference type that is, e.g.

Runnable r = () -> {}; 

Leave a Comment