What they're testing
Whether you think about the CALLER of your code, and whether you're consistent across a codebase.
The short answer~30 seconds
The original rule: checked for conditions the caller can recover from and should be reminded of; unchecked for programming errors. In practice most modern frameworks, Spring included, lean heavily unchecked — because checked exceptions leak through every layer's signature and push people toward catch (Exception e) {}. I default to unchecked and use checked only when the caller genuinely has an alternative course of action.
The long answer
The strongest argument against checked exceptions isn't verbosity but that they break encapsulation: adding a call that throws IOException deep down forces you to change the signature of every method on the path, meaning an implementation detail leaks all the way to the public API. It's also why the functional APIs — Stream, Optional, CompletableFuture — are effectively unusable with lambdas that throw checked exceptions.
The defence has a point at system boundaries though: when you call outward — files, network, another process — failure is ordinary rather than a bug, and making the caller see it has value. The mature answer distinguishes by layer: checked (or an explicit result type) at the outer boundary, unchecked inside the domain.
More important than either choice: don't swallow exceptions. catch (Exception e) { log.error(e); } and carrying on turns a clear failure into silently wrong data. If you can't handle it, let it propagate, or wrap it with context (throw new OrderFailed("order " + id, e)) — passing the cause, because losing the original stack trace loses your ability to investigate.
What they'll ask next
?Does finally always run?
Nearly always, except for System.exit(), a JVM crash, or a killed thread. The trap worth remembering: a return inside finally SWALLOWS the in-flight exception, and that's a nasty bug to locate. Prefer try-with-resources, which closes in the right order and keeps the original exception with the other attached as suppressed.
These lose points
- An empty
catch (Exception e) {}, or juste.printStackTrace(). Both say "I saw the failure and chose to hide it". - Using exceptions for ordinary control flow. Building a stack trace is expensive, and it drains the word "exceptional" of meaning.