Java Developer track

Java interview questions and answers

Java interviews test collections, object-oriented design, the JVM, memory and threads. Then you solve a coding problem. Practice both with follow-ups.

Start a free mock interview

Questions

Interview questions and answers.

Real questions from this track, from easier to harder, with what a good answer covers. In the mock interview, each one comes with follow-ups based on what you say.

  1. Objects

    What is the difference between == and equals in Java?

    A good answer covers that == compares references for objects, meaning whether they are the same object.

  2. Collections

    When do you use a List, a Set and a Map?

    A good answer covers that a List keeps order and allows duplicates.

  3. Errors

    What is the difference between checked and unchecked exceptions?

    A good answer covers that checked exceptions must be caught or declared with throws.

  4. OOP

    When do you use an interface and when an abstract class?

    A good answer covers that an interface defines what a type can do, and a class can implement many.

  5. JVM

    What does the JVM do?

    A good answer covers that Java compiles to bytecode, and the JVM runs that bytecode.

  6. Objects

    Why must equals and hashCode be overridden together?

    A good answer covers that hash-based collections like HashMap use hashCode to find the bucket and equals to find the match.

  7. Objects

    Why are Strings immutable in Java, and what does that mean for your code?

    A good answer covers that a String can never change once made; methods return new strings.

  8. Objects

    How do you avoid NullPointerExceptions in Java?

    A good answer covers that null means no object, and calling a method on it throws.

  9. Streams

    How do Java streams work, and when should you use them?

    A good answer covers that a stream describes steps like map and filter that run when a terminal operation is called.

  10. Generics

    How do generics work in Java, and what is type erasure?

    A good answer covers that generics let a class or method work with many types and keep type safety.

  11. Concurrency

    How do you run work in the background in Java?

    A good answer covers that an ExecutorService manages a pool of threads so you do not create one per task.

  12. Resources

    What does try-with-resources do?

    A good answer covers that resources declared in it are closed automatically, even when an exception is thrown.

  13. Frameworks

    What is dependency injection, and how does Spring use it?

    A good answer covers that a class receives what it needs instead of creating it.

  14. Collections

    How does a HashMap work inside?

    A good answer covers that it stores entries in buckets picked from the key's hash code.

  15. Objects

    What are records, and when do you use them?

    A good answer covers that a record is a class for data, with fields, constructor, equals, hashCode and toString made for you.

  16. Objects

    How do you make a class immutable, and why?

    A good answer covers that fields are final and private, set once in the constructor, with no setters.

  17. Testing

    How do you test a Java service?

    A good answer covers that unit tests with JUnit cover logic, using fakes or Mockito at the edges.

  18. Language

    How do sealed types and pattern matching change Java code?

    A good answer covers that a sealed interface lists every class allowed to implement it.

  19. Concurrency

    What do volatile and synchronized guarantee?

    A good answer covers that without them, one thread may not see another's writes in time or in order.

  20. JVM

    How does garbage collection work in the JVM, and how do you tune it?

    A good answer covers that most objects die young, so the heap is split into young and old areas.

  21. Concurrency

    How do you combine async calls with CompletableFuture?

    A good answer covers that thenApply and thenCompose chain steps without blocking a thread.

  22. Concurrency

    What are virtual threads, and when do they help?

    A good answer covers that virtual threads are cheap threads managed by the JVM, so you can run millions.

  23. Frameworks

    How does @Transactional work in Spring, and what are its traps?

    A good answer covers that Spring wraps the bean in a proxy that starts and commits the transaction.

  24. Architecture

    How would you structure a large Java codebase for several teams?

    A good answer covers that code is split into modules by domain with clear public APIs.

  25. Persistence

    What problems do teams hit with JPA and Hibernate, and how do you avoid them?

    A good answer covers that lazy loading causes N+1 queries and errors outside a session.

  26. JVM

    A Java service has slow requests under load. How do you find the cause?

    A good answer covers that you check GC pauses, thread pools and connection pools before code.

  27. JVM

    How would you move a large service from Java 11 to a current LTS?

    A good answer covers that libraries and frameworks must support the new version first.

  28. Concurrency

    When would you choose a reactive stack like WebFlux over plain blocking code?

    A good answer covers that reactive code handles many waiting connections with few threads.

  29. Architecture

    How would you run Java across dozens of teams and services?

    A good answer covers that a shared platform sets versions of Java, Spring and key libraries.

  30. JVM

    Your Java services cost too much in memory and start too slowly for autoscaling. What are your options?

    A good answer covers that heap and container limits are tuned from measured use.

  31. Concurrency

    How would you design a high-throughput Java service so concurrency bugs are rare?

    A good answer covers that shared mutable state is avoided, using immutable data and message passing.

  32. JVM

    What would you put in place to run JVM services well in production?

    A good answer covers that metrics cover requests, pools, GC and heap for every service.

What it covers

Topics.

  • Objects
  • Concurrency
  • JVM
  • Collections
  • Frameworks
  • Resources
  • Architecture
  • Errors
  • OOP
  • Streams
  • Generics
  • Testing

How it works

How the mock interview runs.

  1. Concept questions that start simple and get harder.

  2. Follow-ups on every answer, so you explain the why.

  3. One coding challenge in a live editor.

Your report scores technical correctness, problem-solving & tradeoffs, communication clarity, with quotes from your answers as proof.

Questions.

What Java questions come up most?

Expect equals and hashCode, and what happens inside a HashMap. You may get interfaces versus abstract classes. Garbage collection and thread safety come up a lot too.

How does an Orin mock interview work?

You talk with Orin by voice, like a video call. It asks questions, listens and asks follow-ups based on what you said. Coding happens in a live editor and design on a live whiteboard. After the interview you get a report with quotes from your answers, what cost you points and what to practice next.

Is it free?

Your first interview is free: a 15-minute round with a short coding exercise. No card needed.

Practice the real thing.

A java developer mock interview by voice, with follow-ups and feedback you can use. First interview free.

Start free interview