Walk into the interview already prepared.

Timed mock tests and model answers written by working engineers, for every level from fresher to lead. Pick any of our 75 courses below.

Topic: Java & Spring Boot. Questions are shared by related courses. View the Java course →

All Java interview questions at a glance+

Fresher (0–3 years): Junior Java Developer

  1. Explain the four pillars of OOP with Java examples.
  2. ArrayList vs LinkedList: when would you use each?
  3. How do you build a REST API with Spring Boot?
  4. What does the JVM do?
  5. == vs equals() for strings?
  6. Which collection keeps unique elements?
  7. What is method overloading?
  8. Spring Boot is mainly used to…
  9. Checked exceptions must be…

Mid-level (3–8 years): Java Developer

  1. A Spring Boot service has rising response times. How do you investigate?
  2. How do you secure a Spring Boot REST API?
  3. Explain Java memory: heap, stack and garbage collection.
  4. What does stream().filter(x -> x > 2).map(x -> x * 2).toList() do on [1, 2, 3, 4]?
  5. Which keyword ensures visibility of a variable across threads?
  6. What does @Transactional ensure?
  7. An N+1 query problem in JPA is fixed by…
  8. ConcurrentHashMap is preferred over a synchronized HashMap because…
  9. Which tool helps diagnose high memory usage in a JVM?

Experienced (8–15 years): Senior Java Engineer / Architect

  1. Design a scalable order-processing system in Java.
  2. How would you migrate a large Spring app to newer Java and Spring versions?
  3. How do you lead code quality in a Java team?
  4. Virtual threads (Java 21) mainly help…
  5. Resilience patterns between microservices include…
  6. Breaking a monolith is best done with…
  7. Event-driven communication via Kafka mainly provides…
  8. Choosing a GC for low-latency services, you would evaluate…
  9. Records (Java 16+) are useful for…