Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumJavaCompletableFuture compositionSingle-choice MCQ

A CompletableFuture completed exceptionally with an IllegalStateException. One caller uses join(), another uses get(). Which exception types do they throw?

CompletableFuture<Integer> f = CompletableFuture.supplyAsync(() -> { throw new IllegalStateException(); }); // caller 1: f.join(); // caller 2: f.get();