Interview Q&A / Java

INTERVIEW Q&A · 72 QUESTIONS

Java interview questions

Collections, the JVM, strings, exceptions and threads, the backbone of most campus placement rounds.

  1. What is a method reference in Java and when would you use it instead of a lambda?

    A method reference is a shorthand like String::length for a lambda that only calls one existing method. It makes code shorter and clearer when the lambda adds nothing beyond that call.

    BeginnerQuick answer1 min read