☕ Java Advanced

What is Reactive Programming and how does Java support it?

Why Interviewers Ask This

Advanced questions like this reveal whether a candidate has internalized Java deeply enough to make architectural decisions. Strong answers demonstrate both breadth and depth of experience.

Answer

Reactive programming is a programming paradigm centered on asynchronous data streams and the propagation of change. It handles backpressure — when producers emit data faster than consumers can process — by allowing consumers to signal how much data they can handle. Java supports it through the java.util.concurrent.Flow API (Java 9), which standardizes the Reactive Streams specification with four interfaces: Publisher, Subscriber, Subscription, and Processor. Major frameworks: Project Reactor (used by Spring WebFlux) provides Mono<T> (0-1 elements) and Flux<T> (0-N elements). RxJava provides Observable, Flowable, Single, and Maybe. Reactive is ideal for I/O-bound, high-concurrency scenarios.

Common Mistake

Don't just define the term — demonstrate that you understand when to use it and when not to. Showing awareness of trade-offs is what separates average from strong Java candidates.