📜  什么是用户定义的异常 - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:31.732000             🧑  作者: Mango

代码示例1
To create customized error messages we use userdefined exceptions. 
We can create user defined exceptions as checked or unchecked exceptions.
We can create user defined exceptions that extend Exception class or 
subclasses of checked exceptions so that userdefined exception becomes checked.
Userdefined exceptions can extend RuntimeException to create userdefined 
unchecked exceptions.

It is recommended to keep our customized exception class as unchecked,i.e 
we need to extend Runtime Exception class but not Excpetion class