Java program to create a custom exception class
belongs to collection: Java Exception Handling Programs
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
belongs to collection: Java Exception Handling Programs
total answers (1)
In this program, we will create a custom exception class by extending the Exception class. Then we will throw created exception in the try block, which is caught in the catch block, and print the exception message.
Program/Source Code:
The source code to create a custom exception class is given below. The given program is compiled and executed successfully.
Output: