Home › Blog › Java interview questions

Java interview questions

Java interviews are more standardised than most, which is good news: the ground they cover is predictable. It splits cleanly into core semantics, collections, and concurrency, and the third is where most candidates come unstuck.

Core language

Collections

Concurrency is where Java loops are decided. Most candidates are solid on collections and vague on the memory model, so depth here is disproportionately valuable.

Concurrency

Modern Java and the JVM

If the role is on a recent LTS, expect streams (lazy evaluation, when a stream is slower than a loop), `Optional` used properly rather than as a null wrapper, and records. On the JVM side: heap versus stack, roughly what generational garbage collection does, and how you would approach an `OutOfMemoryError` in production - heap dump first, not a bigger heap. Spring-specific questions are their own topic and are usually flagged in the job description.

How deep it goes by level

Whatever the level, the reliable way to prepare is to say your answers out loud rather than reading them. Most of what candidates lose in a Java interview is lost in the gap between knowing something and explaining it under observation - the method is in how to use AI for interview prep.

Where CoPilot Interview fits

Disclosure: we build an interview assistant, so treat this as a disclosed pitch. CoPilot Interview is a native Windows and macOS app that puts suggested answers on your own screen in about two seconds, across coding, system design and behavioral rounds, with a permanent free tier that needs no credit card.

Frequently asked questions

What are the most common Java interview questions?

The `equals` and `hashCode` contract, how `HashMap` works internally, `ArrayList` versus `LinkedList`, what `volatile` guarantees, and the difference between checked and unchecked exceptions. Concurrency questions are where candidates most often struggle.

What happens if you override equals but not hashCode?

Objects that are equal can produce different hash codes, so hash-based collections break - you put an object into a `HashSet` or `HashMap` and cannot find it again, because the lookup goes to a different bucket. That concrete failure is the answer interviewers want.

What does volatile guarantee in Java?

Visibility, not atomicity. Writes to a volatile field are visible to other threads immediately, but a compound operation like increment is still not thread-safe. Confusing the two is one of the most common mistakes in Java concurrency questions.

Is ArrayList or LinkedList better?

`ArrayList` in almost all real cases. The big-O table favours `LinkedList` for insertions, but contiguous memory and cache locality mean `ArrayList` usually wins in practice, and saying that shows practical experience rather than textbook recall.

Walk into the round with a second pair of eyes

CoPilot Interview is a native Windows and macOS app that puts suggested answers on your own screen in about two seconds, across coding, system design and behavioral rounds. The free tier is permanent: 15 minutes a day, no credit card.

Try it free