-2

create custom exceptions in java without exception class is it possible?

even if i have write required classes and interfaces for new class and extend that class to create custom Exception?

1 Answers1

0

What would your Exception be in this case? To name something as Exception in Java, you need to inherit from Java Exception class. I don't see any other possibility. If you need to throw something if certain circumstances happen, it needs to be inherited from Exception class - no matter if it is your own created Exception class or if it is any of built-in Java Exception classes.

Przemysław Moskal
  • 3,551
  • 2
  • 12
  • 21