java - Why can't I assign lambda to Object? -


i trying assign lambda object type:

object f = ()->{}; 

and gives me error saying:

 target type of expression must functional interface 

why happening, , how this?

it's not possible. per error message object not functional interface, interface single public method need use reference type is, e.g.

runnable r = () -> {};  

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -