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.
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.
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.
When do you use a List, a Set and a Map?
A good answer covers that a List keeps order and allows duplicates.
What is the difference between checked and unchecked exceptions?
A good answer covers that checked exceptions must be caught or declared with throws.
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.
What does the JVM do?
A good answer covers that Java compiles to bytecode, and the JVM runs that bytecode.
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.
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.
How do you avoid NullPointerExceptions in Java?
A good answer covers that null means no object, and calling a method on it throws.
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.
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.
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.
What does try-with-resources do?
A good answer covers that resources declared in it are closed automatically, even when an exception is thrown.
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.
How does a HashMap work inside?
A good answer covers that it stores entries in buckets picked from the key's hash code.
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.
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.
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.
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.
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.
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.
How do you combine async calls with CompletableFuture?
A good answer covers that thenApply and thenCompose chain steps without blocking a thread.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
How it works
How the mock interview runs.
Concept questions that start simple and get harder.
Follow-ups on every answer, so you explain the why.
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