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.