Core Java Interview Questions for Experienced Developers (2026): What Interviewers Really Ask

By Preeti Verma

If you have two to five years of Java behind you, the interview changes shape. Nobody asks "What is encapsulation?" any more. They describe a slow endpoint, a lost update or a class that misbehaves under load, and they watch how you think.

This guide covers the Core Java areas that come up most often for experienced developers. For each one you get the scenario version of the question and what a strong answer includes. Use it to check your own understanding out loud, not to memorise lines.

1. HashMap and its relatives

How it is asked: "Your service shares one HashMap across request threads and lookups behave strangely. What is going on, and how would you fix it?"

A strong answer covers:

  • How a HashMap finds a bucket (hash of the key, then an index into the array) and what happens on a collision.
  • That buckets turn into trees when they get long, and the table resizes when the load factor is crossed.
  • Why concurrent writes can lose updates, and the options: ConcurrentHashMap, a synchronized wrapper, or confining the map to one thread.
  • The trade-off between them, not just the names.

If you can also explain why ConcurrentHashMap rejects null keys and values, you have shown depth. We wrote a plain-English walkthrough in HashMap vs ConcurrentHashMap explained simply.

2. equals() and hashCode()

How it is asked: "You overrode equals() but not hashCode(), and your HashMap cannot find keys any more. Why?"

The contract is short: equal objects must have equal hash codes. Break it and a lookup goes to the wrong bucket, so the key looks missing even though it is present. Mention that mutable keys are dangerous for the same reason, and you will stand out.

3. Immutability and defensive copies

How it is asked: "Design a class that is immutable and thread-safe. What mistake do people make with a List field?"

Cover the checklist: final class, private final fields, no setters, and copies of mutable inputs and outputs. The classic mistake is storing the caller's list and returning it from a getter, which lets outside code change your "immutable" object.

4. Multithreading

How it is asked: "Two users update the same account balance and one update disappears. How does that happen, and what would you use to prevent it?"

Talk about the race on read-modify-write, then compare your options honestly:

  • synchronized is simple and gives visibility as well as mutual exclusion.
  • volatile gives visibility only, so it is not enough for a counter.
  • AtomicInteger and friends are lock-free for single variables.
  • ReentrantLock adds tryLock, timeouts and fairness when you need them.

Add one sentence about deadlock: it needs four conditions, and the easiest to break is usually lock ordering.

5. Executors and CompletableFuture

How it is asked: "You must call three services and combine the results. How would you do it?"

A good answer uses a bounded thread pool (and explains why creating a new thread per request is a bad idea), then shows CompletableFuture composition with a sensible timeout and error handling. Mention that blocking on future.get() inside a request thread gives up much of the benefit.

6. Streams and modern Java

How it is asked: "You wrote a stream pipeline and nothing runs. What did you forget?" and "Would you use a parallel stream for 100 items? For 10 million?"

Know that streams are lazy until a terminal operation, that a stream can be used once, and that parallel streams share the common ForkJoinPool, which can hurt a web application. For Java 17, be ready to say when you would use a record, a sealed class or pattern matching in real code.

7. Exceptions and class loading edge cases

Interviewers like small tricky questions here: what happens if you throw from a static block, whether a try can have two finally blocks, and how final, finally and finalize differ. Answer these in one or two calm sentences. They are checking precision, not trivia.

8. Collections choices

How it is asked: "You need unique items in the order they were added. Which Set, and why not the others?"

Say LinkedHashSet, then explain what HashSet and TreeSet would give you instead. For lists, be ready to say honestly that ArrayList wins in almost every real case and explain why.

How to practise

Reading answers is the slowest way to learn this. Do it like the interview:

  1. Pick a question and answer it out loud without notes.
  2. Check what you missed.
  3. Ask a follow-up, the way an interviewer would, and answer that too.

Our Resources section has 108 Core Java questions written as scenarios, grouped by topic, with a free preview. If a concept still feels foggy, the AI Coach will explain it in simple words and let you ask follow-up questions.

The takeaway

For experienced roles, depth beats breadth. Know a handful of topics well enough to answer the second and third follow-up, and you will do better than someone who has skimmed a hundred definitions.