Lambda: A bound instance method reference closes over a specific receiver object

Writing instance::method fixes the receiver at the moment the reference is created, so the resulting functional interface only ever needs the remaining arguments, not the object itself.

Code
String greeting = "Hello, ";
Function<String, String> prepend = greeting::concat;
System.out.println(prepend.apply("World"));
Output
Hello, World
Advertisement
More in JAVA

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

© Java Coding Hub · About · Contact · Privacy · Terms