Java developer interview: questions and preparation

What is asked in a Java interview, how to answer questions about JVM, collections, and multithreading, and how to rehearse the conversation.

8 min read
Java developer interview: questions and preparation

A Java interview tests not knowledge of syntax — anyone who has written code knows it. It tests understanding of the platform: how memory works, why an application crashes under load, and what happens under the hood of the framework you use every day.

Java developer interview
Java interviews value understanding of the platform, not a list of libraries.

What the interview consists of

StageWhat is assessed
Screeningexperience, stack, salary expectations
Java theoryJVM, memory, collections, multithreading
Live codinghow you write and reason out loud
ArchitectureSpring, DB, transactions, queues

Seven topics that are almost always asked

1. How the JVM works

Classes are loaded via ClassLoader and undergo verification; bytecode is executed by the interpreter with JIT compilation of “hot” sections. The practical takeaway expected: JIT warms up the code, so the first seconds of operation are slower — hence the “warm-up” before a load test.

2. Memory model and garbage collection

The heap is divided into generations: young (Eden + two Survivor spaces) and old. Objects that survive several collections move to the old generation. G1 collects regions and tries to keep pauses predictable. A common question is how to find a leak — the answer is via a heap dump and reference analysis.

3. Collections

ArrayList vs LinkedList (index access vs insertion), HashMap and what happens on a collision, why the key must be immutable, ConcurrentHashMap vs Hashtable. What is valued here is not the definition but choosing the right tool for the task.

4. Multithreading

synchronized vs Lock, volatile and its guarantees, happens-before, thread pools (ThreadPoolExecutor), CompletableFuture. Almost always they give a task: “two threads increment a counter — what will happen” and expect an analysis of the race condition.

5. Spring and dependency injection

Bean lifecycle, scopes, proxies and AOP, why `@Transactional` does not work when calling a method from the same class (self-invocation through a proxy). This question filters out many.

6. JPA, Hibernate and SQL

N+1 queries, lazy and eager loading, first- and second-level caches, transactions and isolation levels. They often ask you to find the problem in a piece of code with entities.

7. Testing and build

JUnit and Mockito, integration tests versus unit tests, Maven/Gradle, CI. They check whether you take code all the way to production.

Preparation for a Java technical interview
Answering out loud reveals gaps that are not visible when reading theory.

How to answer a technical question

The structure works: claim → justification → example → limitation. The last step is what distinguishes a practitioner.

“For this case, I would use ConcurrentHashMap. The reason is that reads come from multiple threads, while Hashtable locks the entire object. In a previous project, this removed a bottleneck in the metrics cache. Limitation: compound operations still need to be wrapped explicitly; per-key atomicity does not save you.”

— a sample answer from practical interview review

Frequently asked questions

How much time is needed to prepare for a Java interview?

A week of 30–40 minutes if you have practical experience: work through the seven topics above, say the answers out loud, and go through one full dialogue once. If a topic (for example, multithreading) is unclear to you, cover it first.

Do they ask about algorithms and data structures?

Yes, but the proportions depend on the company. Product teams more often give practical tasks (debug a bug, optimize a query), large tech companies — classic tasks on arrays, strings, hash tables.

What should I do if I don't know the answer?

Say it directly and show your reasoning: what it is similar to, how you would check. An interviewer almost always distinguishes “I don’t know, but I’m thinking” from making things up, and the latter is a direct minus.

Do I need to know Spring at the source code level?

No, but you need to understand how proxies, transactions, and the bean lifecycle work. These are the questions asked most often, and you can’t answer them by memorizing annotations.

How should I answer about salary expectations?

With a range, not a single number, based on the market. A detailed breakdown is in the article salary negotiations.

How to practice interviewing with AI?

Describe the situation in one phrase — «Java developer interview, Spring Boot, five years of experience» — and go through the dialogue in simulator. The coach will ask questions about your role and review your answers after the conversation.

What's next

Go through the seven topics and mark where the answer doesn't add up. Then run the full dialogue: open HintMeTalk AI, “Coach” mode, describe the vacancy in one phrase. After the debrief, you can see which answers are weak — usually two or three out of ten.

Analyses for other roles: frontend, Python, . General preparation — in the article system analystinterview preparation.

Practise this skill in HintMeTalk AI

Open the app

Sources