~/ learn/ java-from-zero/ cards/ Custom exceptions & common built-ins
1 of 4

Type a custom checked exception class

Type a custom checked exception class

Answer

public class InsufficientFundsException extends Exception { public InsufficientFundsException(String msg) { super(msg); } public InsufficientFundsException(String msg, Throwable cause) { super(msg, cause); } }

Extending Exception makes it checked. Both constructors delegate to the matching Exception constructor. The cause overload enables exception chaining.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/e17f6566-5fd0-4dc0-a6b0-8b23459362fb/flashcard utf-8 LF