Home / Questions / What things should be kept in mind while creating your own exceptions in Java?
Explanatory Question

What things should be kept in mind while creating your own exceptions in Java?

👁 1,622 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

While creating your own exception ?

All exceptions must be a child of Throwable.


If you want to write a checked exception that is automatically enforced by the Handle or Declare Rule, you need to extend the Exception class.


You want to write a runtime exception, you need to extend the RuntimeException class.