Home › coding › java › java method references

Java Method References — Free Java Tutorial

Learn Java Method References in Java with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.

✓ 100% Free ✓ No Login Needed ✓ NCERT / CBSE Aligned ✓ Download as PDF

TL;DR: Learn Java Method References in Java with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.

Written & reviewed by the Syllab.in Academic Team (CBSE/NCERT subject experts) · Updated Jul 14, 2026

🤖 Stuck on any question? Ask Syllab's free AI Tutor for a step-by-step explanation — instant, unlimited, no login.

Java Method References in Java

A method reference is a shorthand for a lambda expression that calls a single existing method. Syntax: ClassName::methodName or instance::methodName.

Four types: (1) Static method: ClassName::staticMethod, (2) Instance method of a specific object: obj::method, (3) Instance method of an arbitrary instance: ClassName::instanceMethod, (4) Constructor reference: ClassName::new.

Method references improve readability when a lambda does nothing but call a method: s -> s.toUpperCase() becomes String::toUpperCase.

They work wherever a functional interface is expected — any context that accepts a lambda.

Java Method References — Syntax

// Lambda vs Method Reference
list.forEach(s -> System.out.println(s));  // lambda
list.forEach(System.out::println);          // method ref

list.stream().map(s -> s.toUpperCase())    // lambda
list.stream().map(String::toUpperCase)      // method ref (instance method)

Arrays.sort(arr, (a,b) -> In

Learn Java Method References step by step with Syllab's free interactive Java tutorial — runnable code examples, practice exercises and instant AI feedback, all free with no signup. Explore the full Java course →

Explore:

  • Syllabus
  • Practice
  • Mock Tests
  • NCERT Solutions
  • Coding
  • GK Quiz
  • Career Predictor
  • AI Tutor
  • Live Quiz
  • Doubt Solver
  • Microlearning
  • Free Alternatives
  • Kids Zone
  • Study Room
  • Calculators
  • Worksheets

Syllab.in — Free learning for Indian students, Class 1–12