Java developer interview questions

A Java developer interview usually covers object-oriented design (interfaces and abstract classes), the JVM and garbage collection, concurrency, SQL and transactions, API design and testing. Senior interviews add diagnosing performance problems in running services. Explain your reasoning out loud, and back claims with examples from systems you have built or maintained.

· 10 questions · Questions from the MiraiHire question bank; tips written by the MiraiHire team.

Technical questions

  1. What is the difference between an interface and an abstract class in Java?

    Foundational

    What the interviewer is looking for: Cover multiple inheritance of interfaces, shared state in abstract classes, default methods, and when you would pick each.

  2. How does garbage collection work in the JVM, at a high level?

    Applied

    What the interviewer is looking for: Explain reachability, generations (young and old), pauses, and how you would notice GC problems in a running service.

  3. How would you diagnose thread contention in a Java service?

    Advanced

    What the interviewer is looking for: Walk through thread dumps, profilers and lock metrics, find the shared lock, then reduce its scope or use concurrent structures.

  4. What is the difference between INNER JOIN and LEFT JOIN?

    Foundational

    What the interviewer is looking for: INNER JOIN keeps only matching rows; LEFT JOIN keeps every row from the left table. A two-table example makes it clear.

  5. What is a transaction, and what does isolation level mean?

    Applied

    What the interviewer is looking for: Explain all-or-nothing changes, then isolation levels with one anomaly each level prevents, such as a dirty or non-repeatable read.

  6. How do you design an API so that a retried request does not create duplicates?

    Advanced

    What the interviewer is looking for: Explain idempotency keys stored with the result, safe HTTP methods, and database unique constraints as a last line of defence.

  7. What makes a good unit test?

    Foundational

    What the interviewer is looking for: Fast, independent, one clear behaviour per test, readable names, and it fails for the right reason.

Behavioural questions

  1. Tell me about a mistake you made at work and what you changed afterwards.

    Applied

    What the interviewer is looking for: Pick a real but recoverable mistake, own it honestly, and spend most of the answer on the fix and what you do differently now.

  2. Describe a time you had to change direction on a project after it had started.

    Advanced

    What the interviewer is looking for: Explain the signal that made you change, how you told the team and stakeholders, and how you limited wasted work.

Answering behavioural questions

Use STAR: the Situation, your Task, the Actions you took and the Result, ideally with a number. Paste your answer into the free STAR checker to see which part is missing.

Check my answer with STAR →

Situational questions

  1. A production issue affects customers and the cause is unclear. Walk me through your first hour.

    Advanced

    What the interviewer is looking for: Show calm order: assess impact, communicate, stop the bleeding (rollback or workaround), then investigate and write down what you learn.

Practise these questions

MiraiHire gives you interview practice sets from this question bank, by text or voice, with feedback. Free to start.

Start practising free