Spring Boot - Exception HandlingWhich class should a custom unchecked exception extend in Spring Boot?Ajava.lang.ExceptionBjava.lang.ErrorCjava.lang.RuntimeExceptionDjava.lang.ThrowableCheck Answer
Step-by-Step SolutionSolution:Step 1: Recall exception hierarchyChecked exceptions extend Exception; unchecked exceptions extend RuntimeException.Step 2: Identify unchecked exception baseFor custom unchecked exceptions, extend RuntimeException to avoid mandatory try-catch.Final Answer:java.lang.RuntimeException -> Option CQuick Check:Unchecked exceptions extend RuntimeException [OK]Quick Trick: Unchecked exceptions extend RuntimeException, not Exception [OK]Common Mistakes:Extending Exception causes checked exception behaviorExtending Error is for serious JVM errors, not custom exceptionsExtending Throwable is too general and not recommended
Master "Exception Handling" in Spring Boot9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More Spring Boot Quizzes Application Configuration - Why configuration matters - Quiz 7medium Exception Handling - @ControllerAdvice for global handling - Quiz 3easy Inversion of Control and Dependency Injection - Field injection and why to avoid it - Quiz 15hard Inversion of Control and Dependency Injection - Why IoC matters - Quiz 8hard REST Controllers - @RequestBody for JSON input - Quiz 10hard REST Controllers - @RequestParam for query strings - Quiz 5medium Spring Boot Fundamentals - Why Spring Boot over plain Spring - Quiz 5medium Spring Boot Fundamentals - What is Spring Boot - Quiz 6medium Spring Boot Fundamentals - Spring Initializr for project creation - Quiz 10hard Spring Boot Fundamentals - How auto-configuration works - Quiz 13medium