1. Notes
(1) For a parent class method overridden by a subclass, the exception type thrown by it can only be the exception class of the overridden method. Subclass or itself
(2) Among them, it is necessary to distinguish: the difference between throw and throws
2. Instance
Customized exception class inheritance The existing exception class
provides a sequence number and several overloaded constructors
public class MyException extends Exception{ static final long serialVersionUID = -70348975766939L; public MyException(){} public MyException(String msg){ super(msg); } }
The above is the detailed content of Things to note about Java custom exception classes. For more information, please follow other related articles on the PHP Chinese website!