Common Interview Questions on Java and Design Patterns

Prepare for Java interviews with pattern questions that test judgment, trade-offs, and language-specific design choices rather than rote definitions.

Strong Java interview answers do more than recite a definition. They explain when a pattern helps, when it is overkill, and how modern Java features affect the choice.

High-Value Interview Questions

  1. When would you use Strategy instead of a large conditional block? A strong answer should talk about variation boundaries, testability, and whether the behaviors are stable enough to justify separate types.
  2. Why is Singleton controversial in Java? A strong answer should mention hidden global state, testing difficulty, lifecycle ownership, and the distinction between true singularity and convenience.
  3. How do DTOs differ from domain objects? A strong answer should focus on boundary shaping, transport concerns, and deliberate omission of internal behavior or state.
  4. When does Builder improve Java code, and when does it just add ceremony? A strong answer should mention optional parameters, staged validation, readability, and the cost of builders for trivial objects.
  5. What is the practical difference between Adapter, Facade, and Proxy? A strong answer should tie each one to a different design pressure: interface mismatch, subsystem simplification, and access control.
  6. How do records change some traditional pattern choices in Java? A strong answer should mention DTOs, immutability, value-style types, and how some boilerplate-heavy patterns become smaller or clearer.
  7. When is DAO still useful in a JPA or Spring Data application? A strong answer should talk about meaningful persistence boundaries versus unnecessary wrapping.
  8. How would you explain composition over inheritance in Java? A strong answer should mention flexibility, testability, and reducing fragile hierarchies.

What Interviewers Usually Want

They are often probing for:

  • design judgment
  • language awareness
  • trade-off thinking
  • ability to keep architecture proportional to the problem

That means concise, experience-shaped answers usually land better than long textbook monologues.

Revised on Thursday, April 23, 2026