Because our own exceptions are derived classes of Exception, Java allows us to create them. A custom exception or user-defined…