A lambda is actually compiled into an implementation of a functional interface. Since by definition a functional interface contains a single method, the compiler can infer what method to invoke so under the covers, it will create an object with that single method and the body of the lambda as the method's body. In Piet's example, the functional interface that gives the lambda expression its context is the Runnable interface. You can use basically the same lambda expression in different contexts.
Here's an example that illustrates this:
The interfaces defined are all functional interfaces that define different methods. The lambda being assigned to each of the interface variables declared on lines 3, 6, 9, and 12 essentially have the same body except they are wrapped in different methods depending on the interface type the lambda expression is given. So, when you assign the expression to a Frog interface reference, you have to call the talk() method. If you assign the lambda to Displayer interface reference, you have to call the show() method, and so on.
The output of that program will be:
In this example, g is an instance of the Glom class and it implements both the Foo and Bar interfaces. With the proper casts you can invoke both foo() and bar() methods on the same object. Can you see why casting in this case works whereas it didn't work in the previous example?
That sort of check is only made on classes at compile time. It is conceivable that a class might implement an interface, so casting of interfaces is allowed at compile time and as Junilu says, you suffer an exception at runtime.
Just shows what a bad idea it often is to cast reference types.