Java custom exception class

Posted in Exception Handling By Raj On December 27, 2017

 

In this article, I am going to explain to you how to write custom exception class or user-defined exception, the custom exception class should extend from Exception, here instead of using FileNotFoundException I am using custom new ExcelFileNotFoundException class

User-defined exception:

Test class :

Output :

custom-exception-class