Java Technical Round Questions & Answers
40 questions for the technical round stage — 4 easy, 27 medium, 9 hard.
About the technical round round
The technical round is the core of a Java interview: concept questions with follow-ups, a live hands-on task and a deep dive into one of your projects. Interviewers check depth, not just definitions.
Tips for the technical round round
- Say your approach out loud before you start writing.
- After a correct answer, expect 'why?' and 'what if?' follow-ups; go one level deeper than the question.
- Pick one project you can explain end to end, including what you would do differently.
- If you get stuck, explain what you would try next instead of going silent.
What is the difference between map() and flatMap()?
Show answer
A getter returns an internal List and callers modify it, causing bugs. How do you fix this?
Show answer
What is dependency injection and why is constructor injection preferred?
Show answer
Flatten a list of lists of integers and compute the sum of squares of the even numbers.
Show answer
Compare the G1, ZGC and Parallel garbage collectors.
Show answer
Write a Spring Data JPA repository method that fetches orders with items to avoid N+1.
Show answer
What is the difference between lazy and eager loading?
Show answer
An API listing 100 orders fires 101 SQL queries. How do you fix it?
Show answer
What is the contract between equals() and hashCode()?
Show answer
Run two tasks in parallel with CompletableFuture and combine their results.
Show answer
Write a minimal Dockerfile for a Spring Boot application.
Show answer
What is the difference between Collectors.toMap() and groupingBy()?
Show answer
What is CompletableFuture and how is it better than Future?
Show answer
Explain bean scopes in Spring.
Show answer
You need to add a new payment method to a system that has a big if-else on payment type. How would you redesign it?
Show answer
Write a unit test for a service class using JUnit 5 and Mockito.
Show answer
Implement an LRU cache using LinkedHashMap.
Show answer
How do you take a thread dump and a heap dump of a running Java process?
Show answer
What is the difference between reduce() and collect()?
Show answer
You need a cache that evicts the least recently used item when full. How would you build it in Java?
Show answer
Map a one-to-many relation between Order and OrderItem in JPA.
Show answer
Group a list of orders by city and sum the amount per city.
Show answer
Explain the happens-before relationship in the Java Memory Model.
Show answer
Clients report duplicate orders when they retry after a timeout. How do you prevent it?
Show answer
Production shows Connection is not available, request timed out after 30000ms from HikariCP. What do you check?
Show answer
Two scheduled jobs on different servers process the same records twice. How do you prevent this?
Show answer
Explain the entity lifecycle states in JPA.
Show answer
What does the volatile keyword guarantee?
Show answer
Write a custom unchecked exception and a Spring handler that returns HTTP 404.
Show answer
What are sealed classes and how do they help?
Show answer
Write a thread safe singleton class in Java.
Show answer
What does effectively final mean for lambdas?
Show answer
Implement the Builder pattern for a User class with many optional fields.
Show answer
What are transaction isolation levels and which problems do they prevent?
Show answer
Write a Java program to check whether a number is prime.
Show answer
What is a ClassLoader and what is the delegation model?
Show answer
What is the difference between an abstract class and an interface in modern Java?
Show answer
What is the difference between JPA, Hibernate and Spring Data JPA?
Show answer
When should you avoid parallel streams?
Show answer
Frequently asked questions
What happens in the Java technical round round?
The technical round is the core of a Java interview: concept questions with follow-ups, a live hands-on task and a deep dive into one of your projects. Interviewers check depth, not just definitions.
How do I clear the technical round round?
Say your approach out loud before you start writing. After a correct answer, expect 'why?' and 'what if?' follow-ups; go one level deeper than the question. Pick one project you can explain end to end, including what you would do differently.
Which round comes next?
A typical order is online assessment, telephonic screening, one or two technical rounds, a managerial round and HR. Use the other round pages to practise each stage.