5 topics · 0/5 read
Multithreading & Concurrency
Threads and their lifecycle, synchronized, volatile and the Java Memory Model, ExecutorService and thread pools, CompletableFuture, locks, atomics and deadlocks.
Threads, Runnable vs Callable and the Thread Lifecycle
Java multithreading questions start with how to create a thread, Runnable vs Callable, the thread states, and the difference between start and run. These basics lead into every harder concurrency question.
Read nowsynchronized, volatile and the Java Memory Model
synchronized gives mutual exclusion and visibility; volatile gives visibility and ordering without locking. Explaining the difference, and the happens-before rules behind them, is a core Java concurrency interview topic.
Read nowExecutorService and Thread Pools
Thread pools reuse threads for many tasks. Interviewers ask about the types of executors, how ThreadPoolExecutor decides between queueing and creating threads, rejection policies, and how to size a pool.
Read nowCompletableFuture and Async Programming
CompletableFuture lets you compose async steps: run calls in parallel, chain transformations, combine results and handle errors without blocking. It is the standard way to call several services at once in a Java backend.
Read nowLocks, Atomic Classes and Deadlocks
Beyond synchronized, java.util.concurrent offers ReentrantLock, read-write locks, atomic classes built on compare-and-swap, and synchronizers like CountDownLatch and Semaphore. Deadlock causes and prevention are classic
Read now