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?
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?
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.