This tutorial will show you how you can create your own custom exception classes. Throughout my previous tutorials, I have demonstrated many exception classes that are derived from RuntimeException. Any class that is derived from the RuntimeException class (and Error) is considered an unchecked exception. Any class that is derived from the Exception class is considered to be a checked exception. I will go into detail on the differences between the two exception types in a future tutorial.
When creating your own exception classes you are free to extend either Exception or RuntimeException, it is not a good idea to extend Error or Throwable. The majority of the time you should extend the Exception class.
This tutorial will build on my Box class and demonstrate how deal with that nagging issue of negative or zero value arguments.
Ещё видео!