Java interviews

Java mock interviews

Java interviews look like a list of definitions — JVM, JDK, the four pillars — but the definition is only ever the first question. The round is decided on the follow-up: why HashMap needs hashCode, what synchronized actually locks, which collection you would pick and what it costs.

Rounds with Sia from ₹99 · Live interviews with a working engineer from ₹299 · Pay per session

What a Java round covers

OOP as you use it

Interfaces against abstract classes, overriding against overloading, and composition over inheritance — asked through code you would write, not as four words to recite.

Collections and their costs

ArrayList or LinkedList, HashMap internals, why equals and hashCode travel together, and when a TreeMap is worth its log n. Expect to choose a collection and defend it.

Concurrency basics

Threads and executors, synchronized and volatile, and what a race condition looks like in a counter. Freshers get the basics; experienced candidates get ConcurrentHashMap and deadlocks.

The JVM, memory and modern Java

Stack against heap, what garbage collection does for you and what it does not, plus lambdas, streams and Optional — and when a plain loop is clearer.

Java interview questions you might be asked

Not a list to memorise. Each is the kind of opening a real round uses, with what a strong answer covers — the follow-ups depend on what you say.

  1. Two Employee objects are equal, but the HashMap cannot find one of them. What went wrong?

    equals was overridden without hashCode, so equal objects land in different buckets. A strong answer states the contract between the two and how to write both.

  2. A counter shared by two threads ends up lower than expected. Why, and how do you fix it?

    count++ is a read, an add and a write, and the threads interleave. Fixes in order of weight: AtomicInteger, synchronized, or a lock — and why volatile alone is not enough.

  3. You need to keep a list where you mostly read by position but sometimes insert in the middle. Which collection?

    Usually ArrayList anyway: the copying is cheap in practice and cache-friendly, while LinkedList pays for every lookup. Saying "it depends on how often" and quantifying it is the answer.

  4. Why does this string-building loop run slowly, and what would you change?

    Strings are immutable, so each += creates a new one. StringBuilder fixes it — and knowing that the compiler already does this for simple concatenation is the follow-up.

  5. When would you not use a stream?

    When a loop is clearer, when you need to break early or handle checked exceptions, or on a hot path where the overhead shows. Streams are a readability tool, not a speed one.

Answer questions like these in a scored round and see exactly where your answer fell short.

What the interviewer is listening for

The signal is whether you know what happens underneath the API. Saying "HashMap is O(1)" is the start; saying when it is not, and why, is the answer that scores.

Where candidates lose marks

  • Reciting definitions that stall on the first "why".
  • Using streams everywhere without being able to say what they cost.
  • Not knowing the collections in your own project well enough to explain the choice.

Two ways to interview

A round with Sia, on your own

One question at a time with real follow-ups on what you actually said. Choose three, five or eight questions. Scored the moment you finish, with a written breakdown across technical depth, problem solving and communication.

A live interview with an engineer

Forty minutes over Zoom with someone who runs Java interviews for a living. They score five criteria and write up what to fix, and you keep a numbered certificate for the session.

Choose Java as your stack in the backend, full-stack or DSA track.

Questions about Java interviews

Which track should I pick for a Java round?

Java can be chosen as your stack in the backend, full-stack and DSA tracks. Backend for APIs and data, DSA if your interview is mostly problem solving in Java, full-stack if you build both ends.

Is a Java round right for a fresher?

Yes. Choose Beginner difficulty and the round stays on core Java — OOP, strings, collections and exceptions — rather than frameworks.

Will I be asked about Spring Boot?

If it is on your resume, expect it: what the framework does for you, dependency injection, and how a request reaches your controller. If it is not, the round stays on core Java.

How is a Java round scored?

On the same five criteria as every round — technical depth, problem solving, communication, behavioural and code quality — with a written breakdown of what each answer missed.

Other technologies

Interviews by track

Not sure which to book? The FAQ covers how sessions are scored, and candidate stories show what people did with the feedback.