Java Developer mock interview questions
19 questions a Java Developer panel actually asks, with what each one tests and what a strong answer contains, then practice any of them live. JVM, Spring and backend design rounds for Java developer interviews.
Answer one real Java Developer question now
A question a Java Developer panel actually asks, answered out loud, scored on what you said and how you said it. Under two minutes, and nothing to sign up for.
“A Spring service method is annotated with @Transactional, but when it is called from another method in the same class, the transaction does not seem to apply. Why?”
We never store the audio. Your answer is deleted within 24 hours unless you save the result.
- Adaptive follow-ups, not a fixed question list
- Rubric scorecard with evidence from your answers
- Voice or text, with delivery coaching on voice sessions
Thinking past the interview? Carmen can help with your whole Java Developer career: a switch, a raise, or what comes next.
19 java developer mock interview questions
The questions a Java Developer panel actually asks, with what each one is testing and what a strong answer contains. Click any question to run it in a live session: your AI interviewer will cover it and score how you answer.
- 1.
A Spring service method is annotated with @Transactional, but when it is called from another method in the same class, the transaction does not seem to apply. Why?
Why they ask it: A classic Spring question that reveals whether you understand proxies rather than treating annotations as magic.
A strong answer: Spring applies @Transactional through a proxy around the bean, so a call from one method to another on the same object bypasses the proxy and the annotation has no effect. Fixes include moving the method to a separate bean, restructuring so the transactional boundary is the entry point, or using programmatic transactions. Mentioning that by default only unchecked exceptions trigger rollback is a strong addition.
- 2.
A page listing orders runs hundreds of SQL queries. What is causing it and how do you fix it?
Why they ask it: The N+1 problem is the most common JPA performance bug. The interviewer wants you to recognise it and know several fixes.
A strong answer: Lazy loading of an association inside a loop triggers one query per parent. Confirm with SQL logging or a query count, then fix with a fetch join, an entity graph, batch fetching, or a DTO projection that selects only what the page needs. Explain the tradeoff that eager fetching everywhere creates different problems.
- 3.
What is the contract between equals and hashCode, and what breaks if you get it wrong?
Why they ask it: A fundamentals check that still catches experienced developers, especially with mutable objects in hash-based collections.
A strong answer: Equal objects must have equal hash codes. If equals is overridden without hashCode, HashMap and HashSet will not find objects that should be equal. Mutating a field used in hashCode after inserting the object into a HashSet means it can no longer be found. Records generate both correctly, and JPA entities need extra care around identifiers.
- 4.
A Java service slows down and then throws OutOfMemoryError after running for a day. How do you investigate?
Why they ask it: JVM troubleshooting is expected of Java developers who own services in production.
A strong answer: Check GC logs and heap usage trends to distinguish a leak from an undersized heap, capture a heap dump on OutOfMemoryError, analyse it with a tool such as Eclipse MAT to find what retains the most memory, and look for common causes such as unbounded caches, static collections, listeners never removed or ThreadLocals in pooled threads. Fix the cause, then add monitoring.
- 5.
How do you run independent calls to three downstream services in parallel and combine the results?
Why they ask it: Tests modern Java concurrency knowledge, from executors to CompletableFuture and virtual threads.
A strong answer: Use CompletableFuture with supplyAsync on a suitable executor and combine with allOf or thenCombine, with timeouts and error handling for each call. Mention that the common pool is not a good choice for blocking IO, and that virtual threads in recent Java versions make simple blocking code with a thread per task practical.
- 6.
Design a service that accepts payments from clients and must not charge anyone twice.
Why they ask it: Backend design question focused on correctness, which Java roles in enterprise and finance care about most.
A strong answer: Idempotency keys stored with a unique constraint, a clear state machine for the payment, database transactions around state changes, an outbox pattern so events are published reliably, retries with backoff to the payment provider, and reconciliation against the provider's records.
- 7.
Tell me about working in a large legacy Java codebase. How did you make changes safely?
Why they ask it: Many Java roles involve long-lived systems. The interviewer wants to see respect for existing code and a method for change.
A strong answer: Add characterisation tests before changing behaviour, refactor in small steps, use feature flags for risky changes, upgrade dependencies and Java versions incrementally, and describe a concrete improvement you made and how you got the team to agree to it.
How the Java Developer interview runs
Usually a recruiter screen, then a coding round in Java focused on collections, clean object-oriented design and tests. A second technical round goes into the JVM and the framework stack, most often Spring Boot and JPA: transactions, persistence behaviour, concurrency and garbage collection. Senior loops add a system design round for a backend service and a behavioural conversation about working in large, long-lived codebases.
What the panel scores
Java and JVM fundamentals
Whether you understand the language and runtime beneath the framework.
- Knows collection contracts such as equals and hashCode
- Diagnoses memory problems with heap dumps and GC logs
- Uses modern Java features appropriately
Framework depth
Whether you understand how Spring and JPA actually work.
- Explains proxies and transaction boundaries
- Recognises and fixes N+1 queries
- Knows rollback rules and propagation basics
Backend design
Whether services are correct and resilient.
- Designs for idempotency and consistency
- Uses concurrency tools correctly
- Handles timeouts and downstream failures
Codebase stewardship
Whether you improve large codebases safely.
- Adds tests before refactoring
- Makes incremental changes
- Explains decisions to the team
Common questions in every interview
These come up in almost every Java Developer interview regardless of the company or the round.
- 8.
Tell me about yourself.
Why they ask it: Opens the interview and sets the frame. The interviewer is checking whether you can select what matters for this job rather than narrate your whole history.
A strong answer: A 60-90 second arc: where you are now, one or two proof points that match the posting, and why this role is the logical next step. Present, past, then future.
- 9.
Why do you want this role?
Why they ask it: Tests whether you read the job description or mass-applied. Weak answers are about what the candidate gets; strong answers connect to the work itself.
A strong answer: Two specifics from the posting or the company's actual work, plus an honest line about what you want to get better at here.
- 10.
Walk me through your resume.
Why they ask it: Checks that your story holds together and that the transitions were deliberate rather than accidental.
A strong answer: Chronological but fast, with a reason attached to each move and more time on the roles closest to this one.
- 11.
Tell me about a time you failed.
Why they ask it: Tests self-awareness and whether you own outcomes. Interviewers are listening for a real failure, not a disguised strength.
A strong answer: A genuine miss, what you specifically got wrong, the cost, and the concrete thing you changed afterwards that has since held up.
- 12.
Tell me about a conflict with a coworker or manager.
Why they ask it: Predicts how you behave when the team disagrees. The trap is blaming the other person.
A strong answer: The substance of the disagreement, what you did to understand their position, how it resolved, and what the working relationship looked like after.
- 13.
What's your greatest strength?
Why they ask it: Checks whether you know what you're actually good at and can prove it.
A strong answer: One strength that maps to the posting, plus a short example where it produced a measurable result.
- 14.
What's your greatest weakness?
Why they ask it: Tests honesty and whether you're actively working on something. Rehearsed non-answers ('I work too hard') read as evasive.
A strong answer: A real limitation that isn't core to the job, the system you built to manage it, and evidence it's improving.
- 15.
Tell me about a time you had to influence someone without authority.
Why they ask it: Almost every role depends on getting people who don't report to you to change course.
A strong answer: What you wanted, why they resisted, the evidence or framing that moved them, and what actually shipped as a result.
- 16.
Where do you see yourself in five years?
Why they ask it: Tests whether this job fits your trajectory, which is a retention question in disguise.
A strong answer: A direction rather than a title, and a line about the skills this role would build toward it. Vague ambition and rigid title-chasing both land badly.
- 17.
Why are you leaving your current job?
Why they ask it: Screens for red flags. Interviewers listen for how you talk about people you no longer work with.
A strong answer: Forward-looking and specific about what you're moving toward. Criticism of a former employer costs you more than it gains, even when it's deserved.
- 18.
What are your salary expectations?
Why they ask it: Checks whether you've done market research and whether you're in range before anyone spends more time.
A strong answer: A researched range with your target near the bottom of it, framed against the scope of the role. Deflect once if the posting has no band, then answer.
- 19.
Do you have any questions for us?
Why they ask it: The most under-prepared question in the interview, and the one that most changes the final impression.
A strong answer: Two or three questions about how the team actually works: what the first 90 days look like, how success is measured, what the hardest part of the job is.
Every round ends in a scorecard like this
Your Java Developer answers, quoted back, scored on what this role is judged on, with the line to say instead.


Real screen from the app. Sample from a product design round.
Related roles
All Engineering →No spam. Unsubscribe anytime.
Ready to practice as a Java Developer?
Sign up free, no card. 30 voice minutes and unlimited typed interviews, each ending in the complete scorecard: rubric scores, strengths, and what to fix next. Nothing is blurred.
- ✓ Predefined role or paste any job description
- ✓ Rubric scores with evidence quotes
- ✓ 888+ roles to choose from
Questions & answers
- Is the Java Developer mock interview free?
- Yes. 30 voice minutes and unlimited typed Java Developer interviews, no card. You get the complete rubric scorecard every time, with the evidence quoted from your own answers. Nothing is blurred.
- Can I use my own job description instead?
- Yes. Predefined roles are starting points. Paste any JD in the setup form and your AI interviewer will tailor questions to that posting.
- How is scoring tailored to this role?
- We pre-fill a realistic Java Developer job description and interview format so questions and the scorecard match how this role is actually interviewed.
- Should I tailor my resume before practicing?
- Run a resume fit check against a Java Developer job description first, then practice the interview with the same JD for a tighter loop.