A lambda has no instance of its own, so this inside its body resolves to the object that was executing when the lambda was created, exactly as if the lambda's code were written inline.
class Reporter {
String name = "reporter";
Runnable asLambda() {
return () -> System.out.println("Lambda this.name: " + this.name);
}
}
new Reporter().asLambda().run();
Lambda this.name: reporter
Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.
Published 2026-09-27