Skip to content
Projects

ViacheslavChernyshov/java-interview-questions-and-answers

View on GitHub

ViacheslavChernyshov/java-interview-questions-and-answers has 62 GitHub stars and 25 forks. Star changes are not measured yet. Last checked 2026-11-14 02:23 UTC. Last push 2026-09-30.

How these counts are measured

Measured star growth

in 24h
Collecting history
in 7 days
Collecting history
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

About

500+ Java interview questions and answers for Junior, Middle, and Senior developers. Covers Spring Boot, Hibernate, SQL, Kafka, Docker, Kubernetes, and more.

Data

README.md

Original

Java Interview Questions and Answers

500+ Java interview questions and answers for Junior, Middle, and Senior Java backend developers. Covers Spring Boot, Hibernate / JPA, SQL, PostgreSQL, Kafka, Docker, Kubernetes, Collections, Concurrency, Stream API, REST / HTTP, JVM memory, design patterns, transactions, microservices, and other high-frequency backend interview topics.

This repository is built as a practical Java backend interview preparation system, not a random dump of prompts. It combines broad topic coverage, layered explanations, multilingual access, and search-friendly landing pages so you can revise fundamentals fast and still go deep where strong interviews usually get difficult.

Start Here

Languages

Why This Repository Stands Out

  • Covers the most common Java backend interview topics in one place instead of scattering them across separate notes
  • Organizes questions by topic, so the repository works both as a roadmap and as a fast reference
  • Keeps every answer structured by level, from fundamentals to senior-level depth
  • Includes English, Ukrainian, and Russian public versions for easier study and wider reach
  • Adds GitHub Pages topic hubs for faster browsing, better internal linking, and stronger search visibility

Who This Helps

  • Java developers preparing for Junior, Middle, or Senior backend interviews
  • Engineers refreshing Spring Boot, JPA, SQL, Kafka, concurrency, or JVM internals
  • Mentors building structured interview-prep roadmaps for teammates
  • Candidates who prefer topic-by-topic repetition instead of scattered cheat sheets

Coverage Snapshot

  • Core Java: collections, HashMap, String, exceptions, Stream API, records, generics, immutability
  • JVM internals: memory, garbage collection, object lifetime, reachability, GC tooling
  • Spring ecosystem: DI, beans, proxies, AOP, transactions, Spring Boot internals
  • Data layer: SQL, PostgreSQL, indexes, MVCC, Hibernate, JPA, locking
  • Distributed backend: Kafka, microservices, retries, resilience, observability
  • Infrastructure: Docker, Kubernetes, health checks, configuration, rollout basics

How to Use This Repository

  • Pick one topic cluster that matches the role you are targeting, for example Spring Boot, SQL, Kafka, or Concurrency
  • Start from the answer library on the site or from the section navigator in GitHub, then move in order because many questions build on previous ones
  • Use the three-layer answer structure to calibrate how deep your own answer should sound in interviews
  • Switch between English, Ukrainian, and Russian versions depending on study comfort or publishing needs

English Question List


📚 Table of Contents

# Topic Questions
20 Records & Generics 27
19 CompletableFuture & Asynchrony 28
18 OOP & SOLID 22
17 Microservices 26
16 Hibernate / JPA 30
15 Kafka 30
14 Docker / Kubernetes 24
13 Immutability 29
12 String 23
11 Transactions 22
10 HashMap / equals / hashCode 29
9 Concurrency 27
8 Stream API 29
7 Exceptions 29
6 REST / HTTP 17
5 Spring / Spring Boot 29
4 Collections 30
3 Memory & Garbage Collection 28
2 Design Patterns 16
1 Databases / SQL / PostgreSQL 21

20. Records & Generics

  1. What is Record in Java and since which version is it available?
  2. What are the main differences between Record and a regular class?
  3. Can you inherit from Record or extend Record from another class?
  4. Can you add additional methods to Record?
  5. Which methods are automatically generated for Record?
  6. Can you override the constructor in Record?
  7. What is a compact constructor in Record?
  8. Can you declare static fields and methods in Record?
  9. Are Record fields final?
  10. Can you use Record as a key in HashMap?
  11. What are Generics in Java?
  12. What are the advantages of using generics?
  13. What is type erasure?
  14. Can you create an array of generic type?
  15. What are bounded type parameters?
  16. What is the difference between <? extends T> and <? super T>?
  17. What is PECS (Producer Extends Consumer Super)?
  18. Can you use primitive types as generic parameters?
  19. What are raw types and why should you avoid them?
  20. What happens when you try to create an instance of generic type via new T()?
  21. What is the difference between List<?> and List<Object>?
  22. Can you overload methods differing only by generic parameters?
  23. What is recursive type bound?
  24. How do generics work with inheritance (is List<String> a subtype of List<Object>)?
  25. What are bridge methods and why are they needed?
  26. Can you use multiple bounds for a single type parameter?
  27. How to implement Singleton pattern using Record?

19. CompletableFuture & Asynchrony

  1. What is CompletableFuture and how does it differ from Future?
  2. What are the main advantages of CompletableFuture over Future?
  3. How to create a CompletableFuture that is already completed with a result?
  4. What is the difference between thenApply() and thenCompose()?
  5. What do methods thenAccept() and thenRun() do?
  6. How to handle exceptions in a CompletableFuture chain?
  7. What is the difference between handle(), exceptionally() and whenComplete()?
  8. How to combine results of multiple CompletableFutures?
  9. What does allOf() method do and when to use it?
  10. What does anyOf() method do and in which cases is it useful?
  11. What is the difference between thenApply() and thenApplyAsync()?
  12. What thread pool is used by default for async methods?
  13. How to specify your own Executor for CompletableFuture?
  14. What is blocking code and how to distinguish it from non-blocking?
  15. Why is it important to avoid blocking operations in CompletableFuture?
  16. How to properly execute multiple parallel requests to microservices?
  17. What does supplyAsync() method do and when to use it?
  18. How to cancel CompletableFuture execution?
  19. What happens if an exception occurs in a CompletableFuture chain?
  20. Can you reuse the same CompletableFuture in multiple chains?
  21. How to implement timeout for CompletableFuture?
  22. What does orTimeout() method do in Java 9+?
  23. What is the difference between thenCombine() and thenCompose()?
  24. How to test code with CompletableFuture?
  25. When is it better to use CompletableFuture vs reactive programming?
  26. What does join() method do and how does it differ from get()?
  27. Can you manually complete a CompletableFuture with a result?
  28. How to implement retry logic with CompletableFuture?

18. OOP & SOLID

  1. What is the Single Responsibility Principle and how to apply it?
  2. Give an example of Single Responsibility Principle violation.
  3. What is the Open/Closed Principle?
  4. How to refactor code that violates Open/Closed Principle?
  5. What is the Liskov Substitution Principle?
  6. Give an example of Liskov Substitution Principle violation.
  7. What is the Interface Segregation Principle?
  8. What is the Dependency Inversion Principle?
  9. Why do we need SOLID principles at all?
  10. What are composition and inheritance?
  11. When is it better to use composition instead of inheritance?
  12. What is delegation in OOP?
  13. How is Single Responsibility Principle related to cohesion?
  14. What happens if a class has multiple reasons to change?
  15. How does SOLID help with code testing?
  16. How is Dependency Inversion related to Dependency Injection?
  17. What is Law of Demeter (principle of least knowledge)?
  18. How to refactor a God Object?
  19. How do SOLID principles help with feature extension?
  20. Can you follow all SOLID principles simultaneously?
  21. How to determine that a class has a single responsibility?
  22. What anti-patterns contradict SOLID principles?

17. Microservices

  1. What is the Saga pattern and when to use it?
  2. What is the difference between choreography and orchestration in Saga?
  3. How to implement distributed transactions in microservices?
  4. What are compensating transactions?
  5. What is the Circuit Breaker pattern?
  6. How does Circuit Breaker work and what states does it have?
  7. What is Service Discovery and why is it needed?
  8. What is the difference between client-side and server-side discovery?
  9. What is API Gateway and what tasks does it solve?
  10. What is sharding?
  11. What is the difference between sharding and partitioning?
  12. How to implement horizontal scaling of microservices?
  13. What is the Database per Service pattern?
  14. What problems arise when using a shared database?
  15. How to organize communication between microservices?
  16. What is the difference between synchronous and asynchronous communication?
  17. How to ensure fault tolerance of microservices?
  18. What is the Bulkhead pattern?
  19. What is the Retry pattern and how to use it properly?
  20. What is exponential backoff?
  21. How to monitor a distributed microservice system?
  22. What is distributed tracing?
  23. How to implement authentication and authorization in microservices?
  24. What is the Strangler Fig pattern?
  25. How to test microservices?
  26. What tools are used for microservice orchestration?

16. Hibernate / JPA

  1. What is the N+1 problem and how to solve it?
  2. What is the difference between Lazy and Eager loading?
  3. When to use Lazy vs Eager loading?
  4. What is LazyInitializationException and how to avoid it?
  5. What fetch strategies exist in Hibernate?
  6. What does @BatchSize annotation do?
  7. Describe the Entity lifecycle in Hibernate.
  8. What are states: transient, persistent, detached, removed?
  9. What is the first-level cache in Hibernate?
  10. What is the second-level cache and when to use it?
  11. How to configure the second-level cache?
  12. What is dirty checking in Hibernate?
  13. How does the flush mechanism work in Hibernate?
  14. What is the difference between persist() and merge()?
  15. What does the refresh() method do?
  16. What is EntityManager and how does it differ from Session?
  17. How to implement optimistic locking in JPA?
  18. How to implement pessimistic locking in JPA?
  19. What is @Version and why is it needed?
  20. How do cascade operations (Cascade) work?
  21. What types of Cascade exist?
  22. What is orphan removal?
  23. How to properly use @OneToMany and @ManyToOne?
  24. What are the peculiarities of bidirectional relationships?
  25. How to avoid infinite recursion during Entity serialization?
  26. What is JPQL and how does it differ from SQL?
  27. What is Criteria API and when to use it?
  28. How to use JOIN FETCH to solve the N+1 problem?
  29. What is projection in JPA?
  30. What types of inheritance does JPA support?

15. Kafka

  1. What is a topic in Kafka?
  2. What is a partition and why is it needed?
  3. How is data distributed across partitions?
  4. What is a message key and how does it affect partitioning?
  5. What is a Consumer Group?
  6. How does consumer load balancing work within a group?
  7. Can you have more consumers than partitions?
  8. What happens when a new consumer is added to a group?
  9. What delivery guarantees does Kafka provide?
  10. What is the difference between at-most-once, at-least-once and exactly-once?
  11. How to configure exactly-once semantics?
  12. What is an offset in Kafka?
  13. How does commit offset work?
  14. What is the difference between auto commit and manual commit?
  15. What is rebalancing and when does it happen?
  16. What is replication in Kafka?
  17. What are leader and follower replicas?
  18. What is ISR (In-Sync Replicas)?
  19. How does Kafka ensure fault tolerance?
  20. What is producer acknowledgment and what modes exist (acks=0,1,all)?
  21. What is a batch in Kafka producer?
  22. How does message compression work?
  23. What is an idempotent producer?
  24. How to handle errors when reading messages?
  25. What is DLQ (Dead Letter Queue)?
  26. How to monitor consumer lag?
  27. What is a retention policy?
  28. How are old messages deleted from a topic?
  29. Can you read messages from a specific partition?
  30. How to implement message filtering on the consumer side?

14. Docker / Kubernetes

  1. What is containerization and why is it needed?
  2. What is the difference between a container and a virtual machine?
  3. What is a Dockerfile?
  4. What are the main instructions used in a Dockerfile?
  5. What is the difference between CMD and ENTRYPOINT?
  6. What is multi-stage build?
  7. What is Docker Compose?
  8. What is Kubernetes and why is it needed?
  9. What is a Pod in Kubernetes?
  10. What is a Node in Kubernetes?
  11. What is a Service in Kubernetes?
  12. What types of Service exist (ClusterIP, NodePort, LoadBalancer)?
  13. What is a ReplicaSet?
  14. How does scaling work in Kubernetes?
  15. What is HorizontalPodAutoscaler?
  16. What is the difference between ConfigMap and Secret?
  17. What is a liveness probe?
  18. What is a readiness probe?
  19. Why are health checks needed?
  20. What is Ingress in Kubernetes?
  21. What is a namespace?
  22. How to organize a rolling update in Kubernetes?
  23. What is a StatefulSet and when to use it?
  24. How to monitor applications in Kubernetes?

13. Immutability

  1. What is an immutable (unchangeable) object?
  2. What advantages do immutable objects provide?
  3. How to create an immutable class in Java?
  4. Why is the String class immutable?
  5. What are the consequences of String immutability?
  6. Why are immutable objects thread-safe?
  7. What is the final keyword and how does it help create immutable classes?
  8. Is making all fields final sufficient for immutability?
  9. What to do if a class field references a mutable object?
  10. What is a defensive copy?
  11. When do you need to make a defensive copy?
  12. How to protect a collection from modifications?
  13. What is Collections.unmodifiableList() and how does it work?
  14. What is the difference between shallow copy and deep copy?
  15. Can you inherit from an immutable class?
  16. Why must an immutable class be final?
  17. What happens if you override a getter in a subclass of an immutable class?
  18. How does String pool work and how is it related to immutability?
  19. Can you change a String value via reflection?
  20. What is Record and how does it help create immutable classes?
  21. Why are LocalDate and LocalDateTime immutable?
  22. What are the advantages of immutable objects for caching?
  23. How does immutability affect performance?
  24. What are persistent data structures?
  25. Are there any disadvantages to immutable objects?
  26. How to implement Builder pattern for an immutable class?
  27. Can you use immutable objects as keys in HashMap?
  28. What happens if you change a mutable key in HashMap?
  29. How to properly work with collections in immutable classes?

12. String

  1. How does String Pool work?
  2. What is the difference between creating a String via literal and via new?
  3. When should you use intern()?
  4. Why is String immutable?
  5. When to use StringBuilder vs StringBuffer?
  6. Why is StringBuffer slower than StringBuilder?
  7. What happens when concatenating strings via the + operator?
  8. How does the Java compiler optimize string concatenation?
  9. Can you use == to compare Strings?
  10. What is the difference between == and equals() for String?
  11. Where is the String Pool stored (in which memory area)?
  12. Can String Pool cause OutOfMemoryError?
  13. What does the substring() method do and how did it work before Java 7?
  14. Why was the substring() implementation changed in Java 7?
  15. How does the split() method work?
  16. What is the difference between replace() vs replaceAll()?
  17. What is String encoding?
  18. How to properly convert a String to byte[] and back?
  19. What are compact strings in Java 9+?
  20. How to find out how much memory a String occupies?
  21. Can you change the content of a String via reflection?
  22. What is String deduplication in G1 GC?
  23. Why does String implement Comparable and CharSequence?

11. Transactions

  1. Decode each letter of ACID.
  2. What transaction isolation levels exist?
  3. What is Read Uncommitted?
  4. What is Read Committed?
  5. What is Repeatable Read?
  6. What is Serializable?
  7. What is a dirty read?
  8. What is a non-repeatable read?
  9. What is a phantom read?
  10. What is a lost update?
  11. What is the default isolation level in PostgreSQL?
  12. What is the default isolation level in MySQL?
  13. What is Propagation in Spring?
  14. What does Propagation.NESTED do?
  15. What is the difference between REQUIRED and REQUIRES_NEW?
  16. What is the @Transactional annotation?
  17. At which level can you use @Transactional?
  18. What is rollback in transactions?
  19. Which exceptions trigger rollback by default?
  20. How to configure rollback for checked exceptions?
  21. What is a readonly transaction?
  22. What happens when you call a @Transactional method from another method of the same class?

10. HashMap / equals / hashCode

  1. How is HashMap structured internally?
  2. What is a bucket in HashMap?
  3. How does HashMap determine which bucket to put an element in?
  4. What is a collision in HashMap?
  5. How does HashMap handle collisions?
  6. What happens when 8 elements are reached in one bucket?
  7. What is the equals() and hashCode() contract?
  8. If two objects are equal by equals(), what can you say about their hashCode()?
  9. If two objects have the same hashCode(), are they necessarily equal by equals()?
  10. What happens if you override equals() but not hashCode()?
  11. What happens if you override hashCode() but not equals()?
  12. Can you use a mutable object as a key in HashMap?
  13. What happens if you change a key after adding it to HashMap?
  14. What are the requirements for a HashMap key?
  15. Why is String often used as a key in HashMap?
  16. What is load factor in HashMap?
  17. What is capacity in HashMap?
  18. When does rehashing occur in HashMap?
  19. What happens during rehashing?
  20. What is the time complexity of get() and put() operations in HashMap?
  21. When can the time complexity become O(n)?
  22. How does HashMap work in a multi-threaded environment?
  23. What is ConcurrentHashMap and how does it differ from HashMap?
  24. Can you store a null key in HashMap?
  25. Can you store a null value in HashMap?
  26. What is the difference between HashMap and Hashtable?
  27. What is WeakHashMap?
  28. How to properly choose initial capacity for HashMap?
  29. Which is better: ArrayList or HashMap for storing key-value pairs?

9. Concurrency

  1. What is the difference between synchronized and volatile?
  2. What is happens-before relationship?
  3. What is the visibility problem?
  4. What is a monitor in Java?
  5. How does synchronized work at the monitor level?
  6. What is the difference between a synchronized method and a synchronized block?
  7. What is a reentrant lock?
  8. What are Atomic classes?
  9. What is CAS (Compare-And-Swap)?
  10. How do AtomicInteger and AtomicLong work?
  11. What are the advantages of Atomic classes over synchronized?
  12. What is a Thread Pool?
  13. What types of Thread Pool exist in Java?
  14. What does ExecutorService do?
  15. What is the difference between Executors.newFixedThreadPool() and newCachedThreadPool()?
  16. What is ForkJoinPool?
  17. What is a deadlock?
  18. What conditions are necessary for a deadlock to occur?
  19. How to prevent deadlock?
  20. What is a race condition?
  21. How to avoid race conditions?
  22. What are Virtual Threads in Java 21?
  23. What are the advantages of Virtual Threads over regular threads?
  24. When should you use Virtual Threads?
  25. What is structured concurrency?
  26. What is the difference between Thread and Runnable?
  27. What are Callable and Future?

8. Stream API

  1. What advantages does Stream API provide?
  2. What is the difference between intermediate and terminal operations?
  3. What does the filter() operation do?
  4. What does the map() operation do?
  5. What does the collect() operation do?
  6. What is a Collector and what built-in Collectors exist?
  7. What does the flatMap() operation do?
  8. What is the difference between map() and flatMap()?
  9. What are parallel streams?
  10. When to use parallel streams?
  11. How to create a parallel stream?
  12. What potential problems can arise with parallel streams?
  13. What is ForkJoinPool and how is it related to parallel streams?
  14. Can you modify the state of external variables in Stream operations?
  15. What are side effects in Stream?
  16. Why should you avoid side effects in Stream?
  17. What does the reduce() operation do?
  18. What is the difference between reduce() and collect()?
  19. What is the peek() operation and when to use it?
  20. Can you reuse a Stream?
  21. What is lazy evaluation in Stream?
  22. When does the execution of Stream operations begin?
  23. What do distinct(), sorted(), limit(), skip() operations do?
  24. How does short-circuiting work in Stream?
  25. What are anyMatch(), allMatch(), noneMatch() operations?
  26. What do findFirst() and findAny() operations do?
  27. How to collect a Stream into a Map?
  28. What to do with key collisions when collecting into a Map?
  29. How to work with Optional in Stream?

7. Exceptions

  1. What is the difference between checked and unchecked exceptions?
  2. What is a checked exception and when to use it?
  3. What is an unchecked exception (Runtime Exception)?
  4. Which exceptions must always be handled?
  5. What is at the top of the exception hierarchy?
  6. What is Throwable?
  7. What is the difference between Error and Exception?
  8. Is the finally block guaranteed to execute?
  9. What is try-with-resources?
  10. What are the requirements for resources in try-with-resources?
  11. What is the AutoCloseable interface?
  12. What is the difference between AutoCloseable and Closeable?
  13. Can you create custom exceptions?
  14. When should you create your own exceptions?
  15. Which is better: extending Exception or RuntimeException?
  16. What is a stack trace?
  17. What does the printStackTrace() method do?
  18. How to properly log exceptions?
  19. What is exception wrapping?
  20. Why shouldn't you swallow exceptions (empty catch)?
  21. What does the throws keyword do?
  22. Can you throw a checked exception from a method without throws?
  23. What happens if an exception also occurs in the finally block?
  24. What are suppressed exceptions?
  25. Can you have multiple catch blocks for a single try?
  26. What is multi-catch?
  27. In what order should you arrange catch blocks?
  28. Can you re-throw an exception?
  29. What is exception chaining?

6. REST / HTTP

  1. What is REST?
  2. What does Stateless mean in the context of REST?
  3. What are the main HTTP methods used in REST?
  4. What is the difference between PUT and PATCH?
  5. What is idempotency?
  6. Which HTTP methods are idempotent?
  7. Why are GET and DELETE idempotent?
  8. Is POST idempotent?
  9. What HTTP status codes do you know?
  10. What is the difference between 401 and 403?
  11. What is RESTful API design?
  12. How to properly name REST endpoints?
  13. Should you use verbs in URLs?
  14. What is HATEOAS?
  15. How to organize REST API versioning?
  16. What is the Content-Type header?
  17. What is the Accept header?

5. Spring / Spring Boot

  1. What is Dependency Injection?
  2. What is the difference between constructor, setter and field injection?
  3. Which injection type is recommended and why?
  4. What is a Bean in Spring?
  5. How to create a Bean in Spring?
  6. What is Bean Lifecycle?
  7. What are the stages of Bean lifecycle?
  8. What is BeanPostProcessor?
  9. What do methods with @PostConstruct and @PreDestroy annotations do?
  10. What is Bean scope?
  11. What scopes exist in Spring?
  12. What is the difference between singleton and prototype scope?
  13. What is a proxy in Spring?
  14. When does Spring create a proxy?
  15. What is AOP (Aspect-Oriented Programming)?
  16. What are aspect, advice, pointcut, join point?
  17. What does the @Transactional annotation do?
  18. Why doesn't @Transactional work with self-invocation?
  19. How to solve the self-invocation problem?
  20. What is auto-configuration in Spring Boot?
  21. How does @SpringBootApplication work?
  22. What is a starter in Spring Boot?
  23. What does the @ComponentScan annotation do?
  24. What is a @Configuration class?
  25. What is the difference between @Component, @Service, @Repository, @Controller?
  26. What does the @Autowired annotation do?
  27. What to do if there are multiple beans of the same type?
  28. What is @Qualifier?
  29. What are profiles in Spring?

4. Collections

  1. What are the main interfaces of the Collection Framework?
  2. What is the difference between List, Set and Queue?
  3. What is the difference between ArrayList and LinkedList?
  4. When to use ArrayList vs LinkedList?
  5. What is the time complexity of operations in ArrayList?
  6. What is the time complexity of operations in LinkedList?
  7. What is Vector and how does it differ from ArrayList?
  8. What is Stack?
  9. What is Queue and what implementations exist?
  10. What is Deque?
  11. What is the difference between HashSet, LinkedHashSet and TreeSet?
  12. How does HashSet work internally?
  13. What is TreeSet and how does it work?
  14. What is Map and what implementations exist?
  15. What is the difference between HashMap, LinkedHashMap and TreeMap?
  16. When to use TreeMap?
  17. What is WeakHashMap?
  18. What is ConcurrentHashMap?
  19. How does ConcurrentHashMap ensure thread-safety?
  20. What is CopyOnWriteArrayList?
  21. When to use synchronized collections?
  22. How to get a synchronized collection?
  23. What is Collections.unmodifiableList() and how does it work?
  24. What is the difference between Iterator and ListIterator?
  25. What are fail-fast and fail-safe iterators?
  26. What is ConcurrentModificationException?
  27. How to properly remove elements during iteration?
  28. What are Comparable and Comparator?
  29. What is the difference between Comparable and Comparator?
  30. What operations does the Collection interface support?

3. Memory & Garbage Collection

  1. What is the difference between Heap and Stack?
  2. What is stored in Heap?
  3. What is stored in Stack?
  4. What is Garbage Collection?
  5. When does an object become a candidate for GC removal?
  6. What is a memory leak in Java?
  7. How can a memory leak occur in Java?
  8. What are generations in GC (young, old, metaspace)?
  9. What is Young Generation?
  10. What is Old Generation (Tenured)?
  11. What is Metaspace (or PermGen)?
  12. What GC algorithms exist?
  13. What is G1 GC?
  14. What is ZGC?
  15. What is Shenandoah GC?
  16. What is stop-the-world?
  17. Which GCs minimize stop-the-world pauses?
  18. What are the -Xms and -Xmx parameters?
  19. What happens on OutOfMemoryError?
  20. What types of OutOfMemoryError exist?
  21. What is a memory leak and how to detect it?
  22. What tools help analyze memory?
  23. What is a heap dump?
  24. How to get a heap dump?
  25. What are GC roots?
  26. What is reachability in the context of GC?
  27. Can you manually invoke GC?
  28. Why shouldn't you call System.gc()?

2. Design Patterns

  1. What are design patterns?
  2. What categories of patterns exist?
  3. What is Singleton?
  4. How to implement a thread-safe Singleton?
  5. What is double-checked locking?
  6. What are the problems with Singleton?
  7. What is the difference between Factory Method and Abstract Factory?
  8. When to use Builder?
  9. What is the Prototype pattern?
  10. When to use Strategy?
  11. How is Observer implemented in Java?
  12. What is the advantage of Decorator over inheritance?
  13. What is the difference between State and Strategy?
  14. What types of Proxy exist?
  15. What is the Iterator pattern?
  16. What anti-patterns do you know?

1. Databases / SQL / PostgreSQL

  1. Why are indexes needed?
  2. How does a B-tree index work?
  3. What is a composite index?
  4. When should you create an index?
  5. What are the disadvantages of indexes?
  6. What is index cardinality?
  7. What types of JOIN exist?
  8. What is the difference between INNER JOIN and LEFT JOIN?
  9. Which is better: JOIN or subquery?
  10. What is a correlated subquery?
  11. What is the difference between WHERE and HAVING?
  12. What does GROUP BY do?
  13. When to use HAVING?
  14. What are window functions?
  15. What does ROW_NUMBER() do?
  16. What do RANK() and DENSE_RANK() do?
  17. How does MVCC work in PostgreSQL?
  18. What is VACUUM in PostgreSQL?
  19. Why is ANALYZE needed?
  20. What is explain plan?
  21. How to optimize slow queries?

📊 Statistics

Metric Value
Total questions 500+
Total categories 20
Each answer has 🟢 Junior + 🟡 Middle + 🔴 Senior
Languages English, Ukrainian, Russian
Formats GitHub repository + GitHub Pages

📂 Repository Structure

README.md
eng/     -> English markdown source
ua/      -> Ukrainian markdown source
ru/      -> Russian markdown source
docs/    -> GitHub Pages SEO site
scripts/ -> site generation and helper scripts

Language Versions

Each file contains answers at three depth levels:

  • 🟢 Junior — simple explanations and the core idea
  • 🟡 Middle — internals, common pitfalls, and practical nuances
  • 🔴 Senior — deep technical details, architectural trade-offs, and production context

Updated: 2026-04-09

Explore related projects